I’ve html like this. I want to only show first li tags and don’t want to show span. How to do this with jquery?
<div id="div1">
<ul class="class2">
<li class="class3"><span class="sfBreadcrumbNodeSeparator">/</span> </li>
<li class="class3"> </li>
<li class="class3"> </li>
</ul>
</div>
$('.class2 li').not(':first').hide();will hide all but the first list items,$('.class2 li:first span').hide();will hide the span. See http://jsfiddle.net/jhfrench/agga6/4/.Or you can do it all in one line using
$('.class2 li:not(":first")' || '.class2 li:first span').hide();. See http://jsfiddle.net/jhfrench/agga6/5/