What is the difference between event.stopPropagation and event.stopImmediatePropagation?
Answer / chaitanya
event.stopPropagation() allows other handlers on the same element to be executed, while event.stopImmediatePropagation() prevents every event from running. For example, see below jQuery code block.
Hide Copy Code
$("p").click(function(event){
event.stopImmediatePropagation();
});
$("p").click(function(event){
// This function won't be executed
$(this).css("background-color", "#f00");
});
If event.stopPropagation was used in previous example, then the next click event on p element which changes the css will fire, but in case event.stopImmediatePropagation(), the next p click event will not fire.
| Is This Answer Correct ? | 0 Yes | 0 No |
How jQuery selectors are executed?
With jquery which operating system is more compatible?
Tell me how to check if number is numeric while using jquery 1.7+? : jquery mobile
Difference between parent() and parents() in jQuery?
what is the use of param() method in jquery .
Define cache paremeter of jquery ajax method?
What are all the ways to include jQuery in a page?
How to include jQuery in ASP.Net project?
What is .detach()? : jquery mobile
What is the use of serialize method in jQuery?
Difference between javascript and jquery?
How does jquery store data related to an element?