I need to add the click event to all the li's
inside a div which has id to the li.
The following script changes for all the li's:
<ul>
<li>
<h4>My Header</h4></li>
<li id="myli1">My li 1</li>
<li id="myli2">My li 2</li></ul>
$("#mydiv li").live('click', function(e) {
alert($(this).attr("id"));
});
I need to add the click events for only the li which has the id attribute.