stopImmediatePropagation() Event Method
Definition and Usage
The stopImmediatePropagation() method can prevent calling other listeners for the same event.
Example
When the button is clicked, the first event handler is executed, and the execution of the other event handlers is stopped:
var x = document.getElementById("myBtn"); x.addEventListener("click", myFunction); x.addEventListener("click", someOtherFunction); function myFunction(event) { alert("Hello World!"); event.stopImmediatePropagation(); } // This function will not be executed function someOtherFunction() { alert("I will not get to say Hello World"); }
syntax
event.stopImmediatePropagation()
Parameters
None
Technical Details
Return Value: | No Return Value |
---|---|
DOM Version: | DOM Level 3 Events |
Browser Support
The numbers in the table indicate the first browser version that fully supports this method.
Methods | Chrome | IE | Firefox | Safari | Opera |
---|---|---|---|---|---|
stopImmediatePropagation() | Support | 9.0 | Support | Support | Support |