W3cubDocs

/DOM

Event.defaultPrevented

Returns a boolean indicating whether or not event.preventDefault() was called on the event.

Note: You should use this instead of the non-standard, deprecated getPreventDefault() method (see bug 691151).

Syntax

bool = event.defaultPrevented 

Example

 if (e.defaultPrevented) {
   /* the default was prevented */
 }

Specifications

Specification Status Comment
DOM
The definition of 'Event.defaultPrevented()' in that specification.
Living Standard
DOM4
The definition of 'Event.defaultPrevented' in that specification.
Recommendation Initial definition.

Browser compatibility

Feature Chrome Edge Firefox (Gecko) Internet Explorer Opera Safari
Basic support 18 (Yes) 6.0 (6.0) 9.0 11.0 5.0
Feature Android Edge Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support ? (Yes) 6.0 (6.0) ? ? 5.0

© 2005–2017 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/Event/defaultPrevented