shadowayex Posted February 7, 2010 Report Share Posted February 7, 2010 I have a list that looks like so: <ul class="vertical"> <li class="right">Menu Item 1 > <ul class="vertical-dsplay"> <li>Menu Item 1-1</li> <li class="right">Menu Item 1-2 > <ul class="horizontal-display"> <li>Menu Item 1-2-1</li> <li>Menu Item 1-2-2</li> <li>Menu Item 1-2-3</li> <li>Menu Item 1-2-4</li> </ul> </li> <li>Menu Item 1-3</li> </ul> </li> <li class="right">Menu Item 2 > <ul class="horizontal"> <li>Menu 2-1</li> <li class="below">Menu 2-2 > <ul class="vertical"> <li>Menu 2-2-1</li> <li>Menu 2-2-2</li> <li>Menu 2-2-3</li> </ul> </li> <li>Menu 2-3</li> </ul> </li> <li>Menu Item 3</li> </ul> And what I'm attempting to do is get all the direct li children from a given ul.For instance, I have a function written that is used like so: getItems([ul object]). When I use ul.getElementsByTagName("li"), I of course get all the li's, even the ones from the child ul's.I only want the li's that are direct descendants from a given ul. Is there a way to get just the direct li's, or to check the retrieved li's from the above mentioned method to check to ensure that the li is direct child? Link to comment Share on other sites More sharing options...
jeffman Posted February 7, 2010 Report Share Posted February 7, 2010 (edited) There might be something here you can adapt. Edited February 7, 2010 by Deirdre's Dad Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now