Monday, December 11, 2023
 Popular · Latest · Hot · Upcoming
rated 0 times [  177] [ 7]  / answers: 1 / hits: 18023  / 15 Years ago, fri, march 6, 2009, 12:00:00

How can I refer to a nested div by id when it has the same id as a div nested in a similarly named div


<div id=obj1>
<div id=Meta>

<div id=obj2>
<div id=Meta>

I want to get the innerHTML of meta


doesn't work

More From » html


IDs should only be used when there is one of that item on the page, be it a SPAN, DIV or whatever. CLASS is what you should use for when you may have a repeating element.

Code there doesn't work because you're referring to an element by unique ID, but have more than one on the page.

[#99886] Friday, February 27, 2009, 15 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.

Total Points: 249
Total Questions: 115
Total Answers: 119

Location: Liechtenstein
Member since Sun, Sep 12, 2021
2 Years ago
gageherberth questions