我们的志愿者还没有将这篇文章翻译为 中文 (简体)加入我们帮助完成翻译
您也可以阅读此文章的English (US)版。

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

文档标签和贡献者

此页面的贡献者: mdnwebdocs-bot, mfluehr
最后编辑者: mdnwebdocs-bot,