GlobalEventHandlers.oncancel

The oncancel property of the GlobalEventHandlers mixin is an EventHandler for processing cancel events sent to a <dialog> element.

The cancel event fires when the user indicates a wish to dismiss a <dialog>. This event handler prevents the event from bubbling, so any parent handlers are not notified of the event.

Syntax

target.oncancel = functionRef;

Value

functionRef is a function name or a function expression. The function receives an Event object as its sole argument.

Only one oncancel handler can be assigned to an object at a time. You may prefer to use the EventTarget.addEventListener() method instead, since it's more flexible.

Specifications

Specification Status Comment
HTML Living Standard
The definition of 'oncancel' in that specification.
Living Standard

Browser compatibility

DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
oncancelChrome Full support YesEdge Full support ≤79Firefox No support NoIE ? Opera ? Safari ? WebView Android Full support YesChrome Android Full support YesFirefox Android No support NoOpera Android ? Safari iOS ? Samsung Internet Android Full support Yes

Legend

Full support
Full support
No support
No support
Compatibility unknown
Compatibility unknown

See also