input

Cette traduction est incomplète. Aidez à traduire cet article depuis l'anglais.

The DOM input event is fired synchronously when the value of an <input> or <textarea> element is changed. Additionally, it fires on contenteditable editors when its contents are changed. In this case, the event target is the editing host element. If there are two or more elements which have contenteditable as true, "editing host" is the nearest ancestor element whose parent isn't editable. Similarly, it's also fired on root element of designMode editors.

General info

Specification
HTML5, DOM Level 3 Events
Interface
Event, InputEvent
Bubbles
Yes
Cancelable
No
Target
Element
Default Action
The value or the content is modified.

Properties

Propriété Type Description
target Lecture seule EventTarget The event target (the topmost target in the DOM tree).
type Lecture seule DOMString The type of event.
bubbles Lecture seule Boolean Whether the event normally bubbles or not
cancelable Lecture seule Boolean Whether the event is cancellable or not?

Browser compatibility

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support (Oui) (Oui) 9 (Oui) (Oui)
immediately after compositionupdate (Oui) 12 (12) (Oui) Pas de support (Oui)
on contenteditable element

(Oui)

14 (14)

Pas de support

Event target is the innermost element at caret position.

15 (Oui)
when designMode is "on"

(Oui)

14 (14)

Pas de support

Pas de support (Oui)
data ? Pas de support ? ? ?
isComposing Pas de support 31 (31) Pas de support Pas de support Pas de support
Feature Android Chrome for Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support (Oui) (Oui) (Oui) ? ? (Oui)
immediately after compositionupdate ? ? 12.0 (12) ? ? ?
on contenteditable element ? ?

14.0 (14)

? ? ?
when designMode is "on" ? ? 14.0 (14) ? ? ?
data ? ? Pas de support ? ? ?
isComposing Pas de support Pas de support 31.0 (31) Pas de support Pas de support Pas de support
Opera does not fire an input event after dropping text in an input field.
IE 9 does not fire an input event when the user removes characters from input filled by keyboard, cut, or drag operations.

Gecko notes

Prior to Gecko 12.0 (Firefox 12.0 / Thunderbird 12.0 / SeaMonkey 2.9), Gecko didn't fire input events while composition was ongoing using IMEs or when dead keys were used on the Mac.

Also the change event is related.

Étiquettes et contributeurs liés au document

 Contributeurs à cette page : Sebastianz, LoicPuchaux
 Dernière mise à jour par : Sebastianz,