Home » Jquery » How to add jQuery Parent and Child Click events

Here is <LI> Tag and inside that there is anchor link tags <A>, so how we can make jQuery click event on both parent and child element.

here is code

$("li").click(function(e) {
   alert("Clicking on the li will trigger this, not the <a> children");
});

$("li a").click(function(e) {
   e.stopPropagation(); // The img children inside li will not trigger the li event.
alert("Clicking on the li will trigger this, not the <a> children");
});

Array ( [0] => Jquery )