KeyboardEvent()

The KeyboardEvent() constructor creates a new KeyboardEvent.

Syntax

 event = new KeyboardEvent(typeArg, KeyboardEventInit);

Values

typeArg

Is a DOMString representing the name of the event.

KeyboardEventInitOptional

Is a KeyboardEventInit dictionary, having the following fields:

Note: The KeyboardEventInit dictionary also accepts fields from the UIEventInit and EventInit dictionaries.

Specifications

Specification
UI Events
# dom-keyboardevent-keyboardevent

Browser compatibility

BCD tables only load in the browser

See also