I have this in my html page:
<nav>
<a></a>
<a></a>
</nav>
but when I run var menuitem = document.getElementsByTagName('nav').childNodes;
it returns “undefined”.
Here is the entire javascript file with the relevant part at the end: http://pastebin.com/bVj2Ug4e
What did I do wrong?
Thanks for the help guys!
this may work for you
as document.getElementsByTagName(‘nav’) will return nodeList, and make sure you are running javascript after the dom ready.