Skip to content

Event: cancelable property ​

The cancelable property indicates whether this event can be canceled with preventDefault().

Value ​

A boolean.

ValueMeaning
truepreventDefault() takes effect
falsepreventDefault() has no effect and doesn't throw

Examples ​

js
console.log(new Event('a').cancelable, new Event('b', { cancelable: true }).cancelable);

Result: The console prints false true.

See also ​