Web APIs

Event.cancelable

Try the free JavaScript compiler

Indicates whether cancellation can prevent the event default action. It does not indicate whether cancellation has already occurred.

Formal Syntax & Structure

javascript syntaxjavascript
event.cancelable

Return Value

boolean

True when cancellation is supported.

Working Example

Example Snippetjavascript
const e=new Event("save",{cancelable:true}); console.log(e.cancelable,e.defaultPrevented); e.preventDefault(); console.log(e.defaultPrevented);
JavaScript Reference