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 |
Explain the starting point of code execution in jquery? : jquery mobile
How can we give face effect in jquery?
What is a jquery library?
What is the difference between jquery's ready and holdready?
What is the use of delay() method in JQuery?
Tell me how do you stop the currently-running animation? : jquery mobile
Why is jquery better than javascript?
What is the difference between javascript and jquery?
Difference between $(this) and 'this' in jQuery?
Which selector has better performance id or class and why?
What is event.stoppropagation? : jquery mobile
What is the difference between event.PreventDefault and event.stopPropagation?