jQuery event.stopImmediatePropagation()Method

jQuery 事件方法jQuery Event Methods

Examples

Execute the first event handler, and prevent the remaining event handlers from being executed:

$("div").click(function(event){
alert("Event handler 1 executed");
    event.stopImmediatePropagation();
});
$("div").click(function(event){
alert("Event handler 2 executed");
});
$("div").click(function(event){
alert("Event handler 3 executed");
});

Try it Yourself »

Definition and Usage

The event.stopImmediatePropagation() method prevents the remaining event handlers from being executed.

This method prevents the event from bubbling up the DOM tree.

Tip:Please use theevent.isImmediatePropagationStopped()method to check whether this method was called on the specified event.


Syntax

event.stopImmediatePropagation()

Parameter Description
event Required.eventThe parameter comes from the event binding function.


jQuery 事件方法jQuery Event Methods

Other Extensions