English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

jQuery event.stopImmediatePropagation() method

Prevent the remaining event handlers from being executed

jQuery Events

The event.stopImmediatePropagation() method stops other handlers from executing.

This method can also prevent the event from bubbling up the DOM tree.

Usageevent.isImmediatePropagationStopped()The method checks whether this method has been called before (on the event object).

Syntax:

event.stopImmediatePropagation()

Instance

Prevent other event handlers from being called:

$("p").click(function(event){
  event.stopImmediatePropagation();
});
$("p").click(function(event){
  // This function will not be executed
  $(this).css("background-color", "red");
});
$("div").click(function(event){
  // This function will be executed
  $(this).css("background-color", "red");
});
Test and see‹/›

Parameter Value

ParameterDescription
eventThisEventThe parameter comes from the event binding feature

jQuery Events