InputEvent
Baseline
Widely available
*
This feature is well established and works across many devices and browser versions. It’s been available across browsers since January 2020.
* Some parts of this feature may have varying levels of support.
The InputEvent interface represents an event notifying the user of editable content changes.
Constructor
InputEvent()-
Creates an
InputEventobject.
Instance properties
This interface inherits properties from its parents, UIEvent and Event.
InputEvent.dataRead only-
Returns a string with the inserted characters. This may be an empty string if the change doesn't insert text (for example, when deleting characters).
InputEvent.dataTransferRead only-
Returns a
DataTransferobject containing information about richtext or plaintext data being added to or removed from editable content. InputEvent.inputTypeRead only-
Returns the type of change for editable content such as, for example, inserting, deleting, or formatting text.
InputEvent.isComposingRead only-
Returns a
Booleanvalue indicating if the event is fired aftercompositionstartand beforecompositionend.
Instance methods
This interface inherits methods from its parents, UIEvent and Event.
InputEvent.getTargetRanges()-
Returns an array of
StaticRangeobjects that will be affected by a change to the DOM if the input event is not canceled.
Specifications
| Specification |
|---|
| Input Events Level 2 # interface-InputEvent |
| UI Events # interface-inputevent |
Browser compatibility
| desktop | mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
InputEvent
|
|
|
|
|
|
|
|
|
|
|
|
|
InputEvent() constructor
|
|
|
|
|
|
|
|
|
|
|
|
|
data
|
|
|
|
|
|
|
|
|
|
|
|
|
dataTransfer
|
|
|
|
|
|
|
|
|
|
|
|
|
getTargetRanges
|
|
|
|
|
|
|
|
|
|
|
|
|
inputType
|
|
|
|
|
|
|
|
|
|
|
|
|
insertFromPasteAsQuotation input type
|
|
|
|
|
|
|
|
|
|
|
|
|
isComposing
|
|
|
|
|
|
|
|
|
|
|
|
|
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
- No support
- No support
- Experimental. Expect behavior to change in the future.