dunno if there's a simple jquery way of doing it, but you could do:

$('#LHNav li').each(function(){
   if ($('> a',this).length==0) {
      //no A href, add it
    } else {
      //do something else
   }
});

flycast wrote:
I am stumped. I have nested unordered lists. I want to attach a click
event to all the list items that do not directly contain an <a> tag.

Attach a click event to:
<li>List item without link</li>

Do not attach click event to:
<li><a href="">Link 1</a></li>

I have this code which attaches the event to both types of tags:
   $("#LHNav").find("li").bind("click", function(){
     //do something
    });

Ideas anyone?


Reply via email to