I have a multi level unordered list (ul, li):
<ul class="onlyme">
<li>one</li>
<li>two</li>
<li>
<ul>
<li>aaa</li>
<li>bbb</li>
</ul>
</li>
</ul>
and I only want the first child elements of ul.onlyme to be selected. I am using the following jQuery to select them
$('ul.onlyme > li').click(function(){
alert('bingo');
});
If I click aaa or bbb, the alert appears twice. What do I need to do to make sure it only selects the li’s with: ‘one’ and ‘two’?
If you mean you want to exclude
lielements that have a nestedul…http://jsfiddle.net/3TsNp/