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?
这可以做到这一点( http://jsfiddle.net/bmqyF/1/ ):
$("ul li.section:has(span.show) ul.items li");
$('li.section:has(span.show) ul.items')
发现li.section
的有span.show
并选择ul.items
内它。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.