In JavaScript, the returnValue property of the Event interface indicates whether the default action for this event has been prevented (MDN). It defaults to true (allow default).
Read the notes below before you rely on this property. Prefer feature detection when support is limited.
Syntax
Use event.returnValue. Start with this line.
JavaScript
event.returnValue = false;
Call
What it does
event.returnValue = false;
Primary signature.
Built into the browser. Read event.returnValue on an Event instance — no import required.
Library declarations
JavaScript
event.returnValue = false;
Parameters
Parameter
Description
preventDefault()
Required. Modern cancel API
Return Value
Return Value
Description
*
Cancel default action
JavaScript Examples
Example 1 — Legacy returnValue = false
Old pattern: set the flag to cancel the default action.
returnValue becomes false. Legacy mirror of the same fact.
Prefer reading defaultPrevented in new code.
Compatibility
Browser Support
Event.returnValue is marked Deprecated on MDN. Engines still implement it for compatibility, but new code should use preventDefault() and defaultPrevented. Also available in Web Workers (still deprecated).
✓ Deprecated
Event.returnValue
Legacy default-cancel flag — migrate to preventDefault() / defaultPrevented.
LegacyDeprecated
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
returnValuePrefer preventDefault
Bottom line: Supported for compatibility, not for new APIs. Prefer event.preventDefault(). See the MDN returnValue reference.
Frequently Asked Questions
It is a boolean Event property that indicates whether the default action for the event has been prevented. It defaults to true (allow default). Setting it to false prevents the default action (MDN).
MDN marks Event.returnValue as Deprecated. Prefer preventDefault() and defaultPrevented. It is not labeled Experimental or Non-standard on that MDN page. Also available in Web Workers.
MDN says returnValue is the opposite of defaultPrevented. If the default was prevented, defaultPrevented is true and returnValue is false.
No. Use preventDefault() to cancel and defaultPrevented to check. Learn returnValue only to read or migrate legacy code.
It only cancels when the event is cancelable (event.cancelable === true), similar to preventDefault(). Non-cancelable events cannot have their default blocked.
No. Event.returnValue is about canceling an event default. HTMLDialogElement.returnValue is the dialog close return string — a different API.