Event.defaultPrevented is a read-only boolean. It is true if preventDefault() successfully canceled the event’s default action, and false otherwise. (MDN: Baseline Widely available since July 2015; also in Web Workers.)
Read the notes below before you rely on this property. Prefer feature detection when support is limited.
Syntax
Use event.defaultPrevented. Start with this line.
JavaScript
event.defaultPrevented
Call
What it does
event.defaultPrevented
Primary signature.
Built into the browser. Read event.defaultPrevented on an Event instance — no import required.
Library declarations
JavaScript
event.defaultPrevented
Parameters
Parameter
Description
cancelable
Required. Must be true or the flag stays false
Return Value
Return Value
Description
*
The current value of event.defaultPrevented.
JavaScript Examples
Example 1 — Read After preventDefault()
See the flag flip from false to true on the same event object.
Target handler first.link2 calls preventDefault() on click.
Bubble continues. The event still reaches document (unless someone stopped it).
Read the flag. Document logic sees defaultPrevented === true for link 2.
Branch the message. Free links log “Visiting…”; canceled ones log the apology.
Compatibility
Browser Support
Event.defaultPrevented is marked Baseline Widely available on MDN (since July 2015). It is also available in Web Workers.
✓ Baseline · Widely available
Event.defaultPrevented
Read-only boolean: true if preventDefault() canceled the event’s default action. Supported across modern browsers and legacy IE for this DOM property.
UniversalWidely available
Google ChromeAll versions · Desktop & Mobile
Full support
Mozilla FirefoxAll versions · Desktop & Mobile
Full support
Apple SafariAll versions · macOS & iOS
Full support
Microsoft EdgeAll versions · Chromium & Legacy
Full support
Internet ExplorerIE 6+ · Legacy environments
Full support
OperaAll modern versions
Full support
Event.defaultPreventedExcellent
Bottom line: Safe to use in production. Pair with cancelable + preventDefault(); read the flag (or dispatchEvent’s return) to confirm cancel.
Frequently Asked Questions
It is a read-only boolean on an Event. It is true if Event.preventDefault() successfully canceled the event’s default action, and false otherwise.
No. MDN marks Event.defaultPrevented as Baseline Widely available (since July 2015). It is not Deprecated, Experimental, or Non-standard. It is also available in Web Workers.
preventDefault() only works when event.cancelable is true (and the listener is not passive). If the event is not cancelable, calling preventDefault() does not set defaultPrevented to true.
In a later listener (for example on document) to see if an earlier handler already canceled the default—useful for logging, analytics, or shared click handlers.
No. stopPropagation stops further travel through the DOM. defaultPrevented only reflects a successful preventDefault() cancel of the browser default action.
For a cancelable event, target.dispatchEvent(event) returns false if preventDefault() was called during dispatch (defaultPrevented is true). It returns true if the default was not prevented.