What is the difference between event.stopPropagation and event.stopImmediatePropagation?
Answer Posted / 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 |
Post New Answer View All Answers
How is the deferred method in jquery important in relation to animate method?
How to use connect?
What is the use of jQuery load method?
What is event.stoppropagation? : jquery mobile
What is the difference between prop and attr?
What are the advantages of method chaining in jquery?
Which one is more efficient, document.getelementbyid( "idname") or $("#idname)?
How we can get the value of a radio button using jquery?
How do I check if an element is hidden in jQuery?
What is jQuery CDN?
What are the two types of CDNs?
What are the methods used to provide effects?
What are the advantages of minified version of jquery?
Can we call c# codebehind method using jquery?
What were the biggest challenges of getting the jQuery 1.7 release ?