English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
Prevent the remaining event handlers from being executed
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).
event.stopImmediatePropagation()
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 | Description |
---|---|
event | ThisEventThe parameter comes from the event binding feature |