Warning: Do NOT use this method; Use the KeyboardEvent()
constructor instead!
The method has been removed from the DOM specification and is not supported by any current browser. Firefox hides this method behind the preference (dom.keyboardevent.init_key_event.enabled
) from version 93 and plans to remove it shortly afterwards.
Deprecated: This feature is no longer recommended. Though some browsers might still support it, it may have already been removed from the relevant web standards, may be in the process of being dropped, or may only be kept for compatibility purposes. Avoid using it, and update existing code if possible; see the compatibility table at the bottom of this page to guide your decision. Be aware that this feature may cease to work at any time.
The KeyboardEvent.initKeyEvent()
method is used to initialize the value of an event created using document.createEvent
("KeyboardEvent")
. Events initialized in this way must have been created with the document.createEvent
("KeyboardEvent")
method. initKeyEvent()
must be called to set the event before it is dispatched.