jquery: stopPropagation vs stopImmediatePropagation

By
Advertisement
stopPropagation will prevent any parent handlers from being executed whilestopImmediatePropagation will do the same but also prevent other handlers from executing.
Quick example from the jquery documentation:
$("p").click(function(event){
  event.stopImmediatePropagation();
});
$("p").click(function(event){
  // This function won't be executed
  $(this).css("background-color", "#f00");
});  

0 comments:

Post a Comment

Online Casino