Three methods for JQuery to cancel event bubbling

web front end nine thousand eight hundred and twenty-eight Nine years ago (2016-03-19)

1. Cancel the default behavior and prevent the event from bubbling by returning false.

 $(element).click(function(){ return false; });

2. Cancel the default behavior by using the preventDefault() method.

 $(element).click(function(e){ e.preventDefault(); });

3. Stop the event bubbling by using the stopPropagation() method.

 $(element).click(function(e){ e.stopPropagation(); });