The preventDefault() method is used on the Event interface. It tells the the user agent (whether that be in the browser, bot, download manager, or another app accessing the Web) that if the event does not get explicitly handled, its default action should not be taken as it normally would be. This means that the default action of an even will not occur when preventDefault() method is used.
The preventDefault() method is used in many different JavaScript frameworks including but not limited to jQuery, React.js, and Angular.js.
You can see and example of it being used with Vanilla JavaScript here .
You can see and example of it being used with jQuery here .
In React.js we can use the preventDefault() method to prevent a browser reload or refresh. You can see and example of it being used with React here .
You can see and example of it being used with Angular here.
PS: This was a question asked on Quora.




Perhaps you can clarify to me something. If you add an event listener to the click, the event will be passed to your handler function. At this point you can preventDefault. But if you don't call that method, how does the event continue to propagate without an explicit instruction to do so?
To me it seems like if you add an event listener, the handler should then have to explicitly propagate the event instead of vice versa.