Event.cancelable
Summary
Indicates whether the event is cancelable or not.
Syntax
JavaScript
Copy Code
<var>bool</var> = event.cancelable
- The result is a
Boolean
, which istrue
if the event can be canceled.
Example
JavaScript
Copy Code
var <var>bool</var> = event.cancelable;
bool
contains true
or false
, depending on whether the event can have its default action prevented.
Notes
Whether an event can be canceled or not is something that's determined when that event is initialized.
To cancel an event, call the preventDefault()
method on the event. This keeps the implementation from executing the default action that is associated with the event.
Specifications
Specification | Status | Comment |
---|---|---|
DOM The definition of 'Event.cancelable' in that specification. |
Living Standard | |
DOM4 The definition of 'Event.cancelable' in that specification. |
Working Draft | |
Document Object Model (DOM) Level 2 Events Specification The definition of 'Event.cancelable' in that specification. |
Recommendation | Initial definition. |
License
© 2016 Mozilla Contributors
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-us/docs/web/api/event/cancelable