DEV Community

mhsohag11
mhsohag11

Posted on

Answer: Apply click method to outer div but not inner div [duplicate]

I think event.stopPropagation() method would be most useful solution.you only need to call it on the children of outer div:

$("#outer").on('click', function () { 
   alert("triggered");
}).children().on('click', function (e) {
    e.stopPropagation();
});

Also check this Solution.

Top comments (0)