I have selected a list that contains sub-lists. Now, I'd like to search for the list items that contain sub-lists (but not including the sub-list-items). I think the example below will explain what I'm trying to do.
HTML: <ul class="start-here"> <li>Do Not Need</li> <li>NEED THIS ITEM <ul> <li>Do Not Need</li> <li>Do Not Need</li> </ul> </li> <li>Do Not Need</li> <li>NEED THIS ITEM <ul> <li>Do Not Need</li> <li>Do Not Need</li> <li>NEED THIS ITEM <ul> <li>Do Not Need</li> <li>Do Not Need</li> </ul> </li> <li>Do Not Need</li> </ul> </li> <li>Do Not Need</li> </ul> jQuery: $('.start-here li').filter(':has(li)').append('<span class="ui-icon ui- icon-plus"></span>'); The above jQuery statement selects the correct <li> but also all child <li>'s, which I do not want.