JQuery select div inside ul that has range
Take the following code:
<ul class="menu">
<li class="section">
<span class="show">ABC</span>
<ul class="items"><li>UL selected</li></ul>
</li>
<li class="section">
<span class="">DEF</span>
<ul class="items"><li>UL not selected</li></ul>
</li>
</ul>
I need to select each ul.items inside li.section, which has a span with the class "show". In this example, only the first ul.items should be selected.
What jquery selector do I need?
+5
2 answers
This can do the trick ( http://jsfiddle.net/bmqyF/1/ ):
$("ul li.section:has(span.show) ul.items li");
+7