i’ve a list in a list like that
<ul>
<li>
<ul>
<li>something</li>
<li>something</li>
</ul>
</li>
<li>
<ul>
<li>something2</li>
<li>something2</li>
</ul>
</li>
</ul>
i use the selector (see below) to hide main list’s second item but this line hides 1. sublist’s second item. I want to hide main list’s second item how can i do this?
$("#main_menu ul li:eq(1)").slideUp();
Try this(assuming
ulis the direct child ofmain_menu).In your selector
#main_menu ul liwill select all thelielements within eachulofmain_menuso you should specify just to search the immediate children by using>child selector.Demo