beforeinput

This is an experimental technology
Check the Browser compatibility table carefully before using this in production.

The DOM beforeinput event fires when the value of an <input>, <select>, or <textarea> element is about to be modified. The event also applies to elements with contenteditable enabled, and to any element when designMode is turned on.

In the case of contenteditable and designMode, the event target is the editing host. If these properties apply to multiple elements, the editing host is the nearest ancestor element whose parent isn't editable.

General info

Interface InputEvent
Sync / Async Sync
Bubbles Yes
Cancelable Yes
Composed Yes
Target Element
Default Action Update the DOM element

Properties

Property Type Description
target Read only EventTarget The event target (the topmost target in the DOM tree).
type Read only DOMString The type of event.
bubbles Read only Boolean Whether the event normally bubbles or not.
cancelable Read only Boolean Whether the event is cancellable or not.

Specifications

Browser compatibility

This event is implemented in WebKit-based browsers, including Chrome and Safari.

See also

Document Tags and Contributors

Contributors to this page: mdnwebdocs-bot, mfluehr
Last updated by: mdnwebdocs-bot,