I’ve been looking for an answer to this question but I could find none so I thought I’d try StackOverflow.
In javascript, is this valid:
x = document.getElementById('myId');
y = x.getElementById('mySecondId');
I know this can be done with getElementsByTagName but I’m not sure if the object returned by getElementById is able to use the getElementById method.
I know that the ID is supposed to be unique per document, but sometimes this is just not the case.
Thanks!
Nope.
…But you can, though:
Try it on this page:
Edit: As Pumbaa80 pointed out, you wanted something else. Well, here it is. Use with caution.
An example: http://jsfiddle.net/3xTcX/