Latest web development tutorials

jQuery event.stopImmediatePropagation () method

jQuery Event Methods jQuery Event Methods

Examples

Implementation of the first event handler, and prevent the rest of the event handler is executed:

$ ( "Div"). Click (function (event) {
alert ( "event handler is executed 1");
event.stopImmediatePropagation ();
});
$ ( "Div"). Click (function (event) {
alert ( "event handler is executed 2");
});
$ ( "Div"). Click (function (event) {
alert ( "event handler is executed 3");
});

try it"

Definition and Usage

event.stopImmediatePropagation () method to prevent the rest of the event handler is executed.

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

Tip: Use event.isImmediatePropagationStopped () method to check whether this method is called on a specified event.


grammar

event.stopImmediatePropagation()

参数 描述
event 必需。 event 参数来自事件绑定函数。


jQuery Event Methods jQuery Event Methods