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
eg
<div id='obj1'> <div id='Meta'> <meta></meta> </div> </div> <div id='obj2'> <div id='Meta'> <meta></meta> </div> </div>
I want to get the innerHTML of meta
document.getElementById('obj1').getElementById('Meta').getElementsByTagName('meta')
doesn’t work
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.