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 to increase cursor size in html body using jquery?
What is the advantage of using the minified version of jquery rather than using the conventional one?
How do you implement animation functionality?
What is queue() in jquery?
What are the slow selectors in jQuery?
Do we need to add the jquery file both at the master page and content page as well?
Define cache paremeter of jquery ajax method?
How can images be made to appear scrolling one over another?
Why is jquery better than javascript?
Consider a scenario where things can be done easily with javascript, would you still prefer jQuery?
Can we use protocol less URL while referencing jQuery from CDNs?
What is the difference between .js and .min.js?