PreventDefault
PreventDefault is a method on Event objects in the Document Object Model (DOM). It cancels the default action the browser would normally perform for the event. After calling it, the browser will not navigate to a link, submit a form, or perform other standard actions associated with the event.
Common uses include suppressing the default behavior of anchor tags, form submissions, and certain keyboard or
PreventDefault only stops the default action; it does not stop event propagation. To stop propagation through
Compatibility and alternatives: preventDefault is supported in all modern browsers. For very old environments, a common
See also: stopPropagation, stopImmediatePropagation, returnValue, Event interface.