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 url paremeter of jquery ajax method?
Jquery can be used in what scenarios?
What the use of $ symbol in jquery.
What is meant by the term ‘theming’ in jquery mobile? : jQuery Mobile
Tell me how to use migrate jquery plugin if possible? : jquery mobile
What is the advantage of using the minified version of jquery rather than using the conventional one?
What is chaining in jQuery?
Define the use of each function in jquery?
What does $("div.parent") will select?
Tell me how to check if number is numeric while using jquery 1.7+? : jquery mobile
Define type paremeter of jquery ajax method?
How do I pull a native DOM element from a jQuery object?