I tried asking this before, but I guess I wasn't specific enough. Suppose I have HTML code that looks like this. How do I ONLY target the tags within the the horizontalNAV using pure JavaScript? Okay I know I could do this using jQuery like this...
<script type="text/javascript">
$(document).ready(function(){
$('#horizontalNAV li a').click(function(){
//jQuery code here...
});
});
</script>
However I do NOT want a jQuery answer, because I want to know how you target ('#horizontalNAV li a') using pure javaScript.
or you can tell me how to do it for the verticalNav portion, either way I'll get it, if I see an example or if its explained to me. If I'm not mistaken you would have to use the document.querySelectorAll method, if so, how does that work in the above example.
<div id="wrapper">
<div id="horizontalNav">
<ul>
<li><a href="#"></a>item1</li>
<li><a href="#"></a>item2</li>
<li><a href="#"></a>item3</li>
</ul>
</div>
<div class="sideBar">
<div class="verticalNav">
<ul>
<li><a href="#"></a>item1</li>
<li><a href="#"></a>item2</li>
<li><a href="#"></a>item3</li>
</ul>
</div>
</div>
</div>