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
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Update compatibility data on GitHub
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
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
cancel
event- HTML
<dialog>
element - Related event handler:
GlobalEventHandlers.onclose
GlobalEventHandlers.oncancel by Mozilla Contributors is licensed under CC-BY-SA 2.5.