InputEvent: InputEvent() constructor
        
        
          
                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.
The InputEvent() constructor creates a new InputEvent object.
Syntax
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.
- optionsOptional
- 
An object that, in addition of the properties defined in UIEvent(), can have the following properties:- inputTypeOptional
- 
A string specifying the type of change for editable content such as, for example, inserting, deleting, or formatting text. 
- dataOptional
- 
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). 
- isComposingOptional
- 
A boolean indicating that the event is part of a composition session, meaning it is after a compositionstartevent but before acompositionendevent. The default isfalse.
 
Return value
A new InputEvent object.
Specifications
| Specification | 
|---|
| UI Events> # dom-inputevent-inputevent> | 
Browser compatibility
Loading…
See also
- InputEvent, the interface of the objects it constructs.