stopImmediatePropagation: Main Tips
- This method is used to stop immediate propagation and prevent other event handlers on the same element from executing.
- It is simply written as
event.stopImmediatePropagation()
- there are no arguments to include.
event.stopImmediatePropagation Explained
The event.stopImmediatePropagation
method doesn't allow other event handlers on the same element to be executed. It can also prevent bubbling up the DOM in the same way as event.stopPropagation method.
Look at the example below. You will see the method preventing the second click event from executing:
Example
$("div").click((event) => {
alert("Handler 1");
event.stopImmediatePropagation();
});
$("div").click((event) => {
alert("Handler 2");
});
Note: check whether the event.stopimmediatepropagation() is applied with the event.isImmediatePropagationStopped method.
Latest Coupon Found:
Verified STAFF PICK
TOP-RATED CODING COURSES
Learn the skills of tomorrow
The best time to learn programming is now - follow this link to access 100+ coding courses and enjoy learning at a very low cost!
Expiration date: 22/04/2021
2287 People Used
Only 92 Left