Name
keyCode — NN n/a IE 4 DOM n/a
Synopsis
Read/Write
The Unicode key value for the keyboard key that triggered the event.
For onKeyPress
events, the value represents the
actual character displayed in a text box (e.g., 65 for
“A” and 97 for “a”). But for
onKeyDown
and onKeyUp
events,
only the uppercase value is returned, regardless of the case of the
character that is rendered. If the event is not keyboard driven, the
value is zero. While you may change the value of this property, it
does not influence the character displayed in the text field. See
Chapter 6 about capturing keyboard events.
Example
if (event.keyCode == 65) { ... }
Value
Integer.
Default
None.
Get Dynamic HTML: The Definitive Reference now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.