What is the difference between event.PreventDefault and event.stopPropagation?



What is the difference between event.PreventDefault and event.stopPropagation?..

Answer / chaitanya

event.preventDefault(): Stops the default action of an element from happening.

event.stopPropagation(): Prevents the event from bubbling up the DOM tree, preventing any parent handlers from being notified of the event. For example, if there is a link with a click method attached inside of a DIV or FORM that also has a click method attached, it will prevent the DIV or FORM click method from firing.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More jQuery Interview Questions

How we can get the input value of an element using jquery?

0 Answers  


What is the need for jquery? : jQuery Mobile

0 Answers  


How to redirect to another page using jquery?

0 Answers  


Can we execute/run multiple Ajax request simultaneously in jQuery? If yes, then how?

1 Answers  


Give a brief idea about jquery mobile? : jQuery Mobile

0 Answers  






Define bind() and unbind elements in jQuery?

0 Answers  


Is it possible to use other client side libraries like MooTools, Prototype along with jQuery?

1 Answers  


What is the use of the animate() method in jquery?

0 Answers  


What are the different types of selectors?

0 Answers  


Can we call C# code behind using jQuery?

0 Answers  


What is the use of jquery .each() function?

1 Answers  


What are jquery plugins?

0 Answers  


Categories