javascript get nested element 1

javascript get nested element

// for the links of the first ul.menu on the page
var menuLinks = document.getElement("ul.menu").getElements("a");
// or you can get all links children of all uls with class menu
var menuLinks = document.getElements("ul.menu a");

Here is what the above code is Doing:
1. Get all the links on the page
2. Get all the links that are children of the first ul with class menu
3. Get all the links that are children of all uls with class menu

Similar Posts