Event.defaultPrevented

SummaryEdit

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).

SyntaxEdit

bool = event.defaultPrevented

ExampleEdit

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

SpecificationsEdit

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

Browser compatibilityEdit

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support 18 6.0 (6.0) 9.0 11.0 5.0

Document Tags and Contributors

Tags: 
 Last updated by: cvrebert,