Web/API/GlobalEventHandlers/oncancel

From Get docs


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 StandardThe definition of 'oncancel' in that specification. Living Standard  

Browser compatibility

Update compatibility data on GitHub

Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
oncancel Chrome

Full support Yes

Edge

Full support ≤79

Firefox

No support No

IE

?

Opera

?

Safari

?

WebView Android

Full support Yes

Chrome Android

Full support Yes

Firefox Android

No support No

Opera Android

?

Safari iOS

?

Samsung Internet Android

Full support Yes

Legend

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


See also