Just a quick one, but I’m having some trouble getting my head around it.
I’m using javascript to detect elements inside a menu:
var nav = document.getElementById('nav');
var list = nav.children.length;
But the menu has nested <ul> for dropdowns, how do I target these?
After looking at your code and actually reading and seeing your fiddle I removed my other answer as it was misinterpreting what you need…
In short you need to write a recursive function to traverse all the child uls when found. I don’t have my development env running so will psuedo code this for you (and I’m sure you’ll get the drift)
//elsewhere
This is the completed recursive function in fiddle form
Working fiddle
CODE