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

The InputEvent() constructor creates a new InputEvent.


 event = new InputEvent(typeArg, inputEventInit);


Is a DOMString representing the name of the event.

Is a InputEventInit dictionary, having the following fields:

  • inputType: (Optional) A string specifying the type of change for editible content such as, for example, inserting, deleting, or formatting text.
  • data: (Optional) A string containging characters to insert. This may be an empty string if the change doesn't insert text (such as when deleting characters, for example).
  • dataTransfer: (Optional) A DataTransfer object containing information about richtext or plaintext data being added to or removed from editible content.
  • isComposing: (Optional) A boolean indicating that the event is part of a composition session, meaning it is after a compositionstart event but before a compositionend event.  The default is false.
  • ranges: (Optional) An array of static ranges that will be affected by a change to the DOM if the input event is not canceled. 

The InputEventInit dictionary also accepts fields from UIEventInit and from EventInit dictionaries.


Specification Status Comment
Input Events Level 2
The definition of 'InputEvent()' in that specification.
Working Draft Initial definition.

Browser compatibility

We're converting our compatibility data into a machine-readable JSON format. This compatibility table still uses the old format, because we haven't yet converted the data it contains. Find out how you can help!

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support 60 31 (31) ? 47 ?
Feature Android Webview Chrome for Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support 60 60 31.0 (31) ? 47 ?

See also

  • InputEvent, the interface of the objects it constructs.

Document Tags and Contributors

Contributors to this page: jpmedley, fscholz, teoli
Last updated by: jpmedley,