View Full Version : getElementsById() for nodes

05-27-2004, 10:28 PM
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.

05-27-2004, 10:35 PM
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