Get to know MDN better
このページはコミュニティーの尽力で英語から翻訳されました。MDN Web Docs コミュニティーについてもっと知り、仲間になるにはこちらから。
This feature is well established and works across many devices and browser versions. It’s been available across browsers since 2022年3月.
cancel は <dialog> 要素で発生するイベントで、ユーザーがブラウザーに対して現在のダイアログを閉じるよう指示した際に発行されます。ブラウザーは、ユーザーが Esc キーを押したときにこのイベントを発行します。
このイベントはキャンセル可能だが、バブリングしません。
<dialog> が Esc キーで閉じられた時、 cancel および close イベントの両方が発生します。
このイベント名を addEventListener() などのメソッドで使用したり、イベントハンドラープロパティを設定したりします。
一般的な Event です。
| HTML # event-cancel |
| HTML # handler-oncancel |
Enable JavaScript to view this browser compatibility table.
This page was last modified on 2025年10月13日 by MDN contributors.
Your blueprint for a better internet.
Visit Mozilla Corporation’s not-for-profit parent, the Mozilla Foundation.
Portions of this content are ©1998–2026 by individual mozilla.org contributors. Content available under a Creative Commons license.