stoppropagation jquery code example

Example 1: jquery prevent event bubbling

$('myclass').bind('amodaldestroy'), function(event) {
    ....does something....
    event.stopPropagation();
});

Example 2: stop immediate propagation

event.stopImmediatePropagation();

Example 3: stop propagation event

$("span").click(function(event){
  event.stopPropagation();
  alert("The span element was clicked.");
});
$("p").click(function(event){
  alert("The p element was clicked.");
});
$("div").click(function(){
  alert("The div element was clicked.");
});

Example 4: javascript event stoppropagation

event.stopPropagation();

Tags:

Misc Example