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

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

What methods used to provide effects?

489


Can there be more than one ready function in jquery?

434


How to find all sibling elements after the current element using ?

485


How to select combobox select value and text using jquery?

437


What is the difference between find and children methods in jquery?

825






What is the method used to define the specific character in place of $ sign?

569


Can you please explain the difference between .js and .min.js? : jquery mobile

403


What is jQuery code to select all links in first paragraph?

467


What is the advantage of using minimized version of jQuery?

488


With jquery ui 1.7 being released in the last few days, what do you see as the key parts of jquery ui 1.7? What are you most proud of out of that release?

572


How do you disable or enable a form element?

451


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

448


What are the effects methods used in jquery?

441


Explain the use jquery.data method?

496


Why is the block display style used for animations?

431