JQuery Programmer Question:

Download Job Interview Questions and Answers PDF

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

JQuery Programmer Interview Question
JQuery Programmer Interview Question

Answer:

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.

Download JQuery Programmer Interview Questions And Answers PDF

Previous QuestionNext Question
What is the difference between .empty(), .remove() and .detach() methods in jQuery?How to set the value of an element using jQuery?