Baseline Widely available
The KeyboardEvent()
constructor creates a new KeyboardEvent
object.
new KeyboardEvent(type)
new KeyboardEvent(type, options)
Parameters
type
A string with the name of the event. It is case-sensitive and browsers set it to keydown
, keyup
, or keypress
.
options
Optional
An object that, in addition of the properties defined in UIEvent()
, can have the following properties:
key
Optional
A string, defaulting to ""
, that sets the value of KeyboardEvent.key
.
code
Optional
A string, defaulting to ""
, that sets the value of KeyboardEvent.code
.
location
Optional
A string, defaulting to 0
, that sets the value of KeyboardEvent.location
.
repeat
Optional
A boolean value, defaulting to false
, that sets the value of KeyboardEvent.repeat
.
isComposing
Optional
A boolean value, defaulting to false
, that sets the value of KeyboardEvent.isComposing
.
charCode
Optional Deprecated
A number, defaulting to 0
, that sets the value of the deprecated KeyboardEvent.charCode
.
keyCode
Optional Deprecated
A number, defaulting to 0
, that sets the value of the deprecated KeyboardEvent.keyCode
.
which
Optional Deprecated
A number, defaulting to 0
, that sets the value of the deprecated UIEvent.which
.
ctrlKey
Optional
A boolean value, defaulting to false
, that sets the value of KeyboardEvent.ctrlKey
.
shiftKey
Optional
A boolean value, defaulting to false
, that sets the value of KeyboardEvent.shiftKey
.
altKey
Optional
A boolean value, defaulting to false
, that sets the value of KeyboardEvent.altKey
.
metaKey
Optional
A boolean value, defaulting to false
, that sets the value of KeyboardEvent.metaKey
.
A new KeyboardEvent
object.
KeyboardEvent
, the interface of the objects it constructs.RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4