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 types of selectors in jquery?
What is difference between .setinterval() and .delay() ?
How to find all sibling elements after the current element using ?
How to always reference latest version of jquery?
What is a jquery ?
What is $() in jquery library?
Explain the features of jquery?
How to get the direct parent of an element using ?
Which one is more efficient, document.getelementbyid( "idname") or $("#idname)?
What are the advantage of using minimized version of jquery?
Define the use jquery.data method?
What is the use jQuery.data method?