Child element click event trigger the parent click event

You need to use event.stopPropagation()

Live Demo

$('#childDiv').click(function(event){
    event.stopPropagation();
    alert(event.target.id);
});​

event.stopPropagation()

Description: Prevents the event from bubbling up the DOM tree,
preventing any parent handlers from being notified of the event.

Leave a Comment