GlobalEventHandlers.oncancel
The oncancel
property of the GlobalEventHandlers
mixin is an event handler 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 |
---|
HTML Standard (HTML) # handler-oncancel |
Browser compatibility
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | |
oncancel |
32 |
79 |
No |
No |
19 |
No |
4.4.3 |
32 |
No |
19 |
No |
2.0 |
See also
-
cancel
event - HTML
<dialog>
element - Related event handler:
GlobalEventHandlers.onclose
© 2005–2021 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/GlobalEventHandlers/oncancel