defaultPrevented
Summary
Gets whether the default action should be canceled.
Property of dom/Eventdom/Event
Syntax
Note: This property is read-only.
var shouldPreventDefault = event.defaultPrevented;
Return Value
Returns an object of type BooleanBoolean
Whether the default action should be canceled.
Usage
Use this property to determine whether the default action of an event was prevented.
Notes
You can set the value of this property to true while processing an event, by calling the preventDefault method. If the event was initialized with the cancelable parameter of initEvent set to false, the default action cannot be prevented.
Related specifications
- DOM Level 3 Events
- Working Draft
See also
Related pages
- SVGZoomEventSVGZoomEvent
- BeforeUnloadEventBeforeUnloadEvent
- CompositionEventCompositionEvent
- CustomEventCustomEvent
- EventEvent
- DragEventDragEvent
- FocusEventFocusEvent
- KeyboardEventKeyboardEvent
- MessageEventMessageEvent
- MouseEventMouseEvent
- WheelEventWheelEvent
- MutationEventMutationEvent
- StorageEventStorageEvent
- TextEventTextEvent
- UIEventUIEvent
Reference
- cancelablecancelable
- preventDefaultpreventDefault
Attributions
Microsoft Developer Network: [Windows Internet Explorer API reference Article]