<ul class="menu">
<li><a href="#">texT</a>
<ul>
<li>text</li>
<li>text</li>
<li>text</li>
</ul>
</li>
<li>text</li>
<li>text</li>
</ul>
How t开发者_如何转开发o get direct <li>
from .menu
?
<li>
inside child <ul>
should not be taken.
Thanks.
You can use the child selector:
$('.menu > li')
I recommend taking a look at jQuery's selector documentation.
You could try the .children()
function:
var lis = $('.menu').children('li');
$(".menu > li")
would this work?
$(".menu > li")
精彩评论