The InputEvent()
constructor creates a new InputEvent
object.
On this page
InputEvent: InputEvent() constructor
Syntax
js
new InputEvent(type)
new InputEvent(type, options)
Parameters
-
type
-
A string with the name of the event. It is case-sensitive and browsers set it to
beforeinput
, orinput
. options
Optional-
An object that, in addition of the properties defined in
UIEvent()
, can have the following properties:inputType
Optional-
A string specifying the type of change for editable content such as, for example, inserting, deleting, or formatting text.
data
Optional-
A string containing characters to insert. This may be an empty string if the change doesn't insert text (such as when deleting characters, for example).
isComposing
Optional-
A boolean indicating that the event is part of a composition session, meaning it is after a
compositionstart
event but before acompositionend
event. The default isfalse
.
Return value
A new InputEvent
object.
Specifications
Specification |
---|
UI Events # dom-inputevent-inputevent |
Browser compatibility
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | |
InputEvent |
60 | 79 | 31 | No | 47 | 60 | 60 | 31 | 44 | 8.0 |
See also
InputEvent
, the interface of the objects it constructs.
© 2005–2023 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/InputEvent/InputEvent