I have a structure that looks like below, I'm trying to get id foo. This is only DIV with an identifier if we exit onclick func(), which means that there will not be other DIVs containing the identifier inside foo. However, inside there foomay be other tags that contain an identifier (for example, bye, hello).
No framework is used.
<div id="bar"></div>
<div id="foo">
<p><p>
<div class="bye">
<input id="bye" type="text" value="test" />
<input id="hello" type="text" value="test" />
<table>
<tr><td onclick="func(event)">1</td></tr>
<tr><td onclick="func(event)">2</td></tr>
</table>
</div>
</div>
source
share