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 a li.section which has a span with class "show". In this example, only the first ul.items should be selected.
What jquery selector do I need?
This could do the trick (http://jsfiddle.net/bmqyF/1/):
$("ul li.section:has(span.show) ul.items li");
$('li.section:has(span.show) ul.items')
Finds the li.section
's that have span.show
and selects the ul.items
within it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With