Getting the correct node
- by YsoL8
Hello
I have this structure in my dom:
<label>London<input type="checkbox" name="London"></label><br>
<div class="innerpost">
<label>N1 2AB<input type="checkbox" name="N1 2AB"></label><br>
<label>E1 1AB<input type="checkbox" name="E1 1AB"></label><br>
</div>
I need a way to select the div from the first checkbox. Something like
parentNode.parentNode.getElementsByTagName("div");
But I'm not getting it right - that particular line selects all the divs one parent above the one I need.