Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Feb 2004
    Posts
    192
    Thanks
    0
    Thanked 0 Times in 0 Posts

    getElementsById() for nodes

    Has there been any talks about giving nodes a getElementsById() function. It seem slike that would be a really good function to have, because my Id attributes don't just go one level deep.

    Of course you can say, well if you wanted the element whose ID is farther down why not just ask for it. And I guess sometimes you want to stay in a level above it for traversing. Of course there are work arounds, it just seems like it would be a useful function.

  • #2
    Senior Coder
    Join Date
    Jun 2002
    Location
    near Oswestry
    Posts
    4,508
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You can't have more than one element with the same ID ... so there's no use for a function that retrieves multiple elements with the same one.

    Are you sure you're not thinking of class names, or some other attribute match? You can make a method to find elements by any criteria using a getElementsByTagName iterator combined with getAttribute
    "Why bother with accessibility? ... Because deep down you know that the web is attractive to people who aren't exactly like you." - Joe Clark


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •