shadowayex Posted February 7, 2010 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 Share Posted February 7, 2010 There might be something here you can adapt. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.