preventDefault

preventDefault if invoked when the cancelable attribute value is true, and while executing a listener for the event with passive set to false, signals to the operation that caused event to be dispatched that it needs to be canceled.

Syntax

event.preventDefault()

Examples

1

2

3

Internal

bubbles

cancelable

composed

composedPath

currentTarget

defaultPrevented

Event

eventPhase

isTrusted

stopImmediatePropagation

stopPropagation

target

timeStamp

type

External

Web Hypertext Application Technology Working Group (WHATWG)

Home Menu