Defines the keycode values for keys that are returned by KeyboardEvent.keyCode.
Important note: There is substantial divergence in how different browsers handle keycodes and their variants in different locales/keyboard layouts. We provide these constants to help make code processing keys more readable.
Constants
- int A = 65
-
const
- int ALT = 18
-
const
- int APOSTROPHE = 192
-
const
CAUTION: This constant requires localization for other locales and keyboard layouts.
- int B = 66
-
const
- int BACKSLASH = 220
-
const
CAUTION: This constant requires localization for other locales and keyboard layouts.
- int BACKSPACE = 8
-
const
- int C = 67
-
const
- int CAPS_LOCK = 20
-
const
- int CLOSE_SQUARE_BRACKET = 221
-
const
CAUTION: This constant requires localization for other locales and keyboard layouts.
- int COMMA = 188
-
const
CAUTION: This constant requires localization for other locales and keyboard layouts.
- int CONTEXT_MENU = 93
-
const
- int CTRL = 17
-
const
- int D = 68
-
const
- int DASH = 189
-
const
CAUTION: This constant requires localization for other locales and keyboard layouts.
- int DELETE = 46
-
const
- int DOWN = 40
-
const
- int E = 69
-
const
- int EIGHT = 56
-
const
- int END = 35
-
const
- int ENTER = 13
-
const
- int EQUALS = 187
-
const
CAUTION: This constant requires localization for other locales and keyboard layouts.
- int ESC = 27
-
const
- int F = 70
-
const
- int F1 = 112
-
const
- int F10 = 121
-
const
- int F11 = 122
-
const
- int F12 = 123
-
const
- int F2 = 113
-
const
- int F3 = 114
-
const
- int F4 = 115
-
const
- int F5 = 116
-
const
- int F6 = 117
-
const
- int F7 = 118
-
const
- int F8 = 119
-
const
- int F9 = 120
-
const
- int FF_EQUALS = 61
-
const
- int FF_SEMICOLON = 59
-
const
- int FIRST_MEDIA_KEY = 166
-
const
- int FIVE = 53
-
const
- int FOUR = 52
-
const
- int G = 71
-
const
- int H = 72
-
const
- int HOME = 36
-
const
- int I = 73
-
const
- int INSERT = 45
-
const
- int J = 74
-
const
- int K = 75
-
const
- int L = 76
-
const
- int LAST_MEDIA_KEY = 183
-
const
- int LEFT = 37
-
const
- int M = 77
-
const
- int MAC_ENTER = 3
-
const
- int MAC_FF_META = 224
-
const
- int META = 91
-
const
- int N = 78
-
const
- int NINE = 57
-
const
- int NUMLOCK = 144
-
const
- int NUM_CENTER = 12
-
const
NUM_CENTER is also NUMLOCK for FF and Safari on Mac.
- int NUM_DELETE = 46
-
const
- int NUM_DIVISION = 111
-
const
- int NUM_EAST = 39
-
const
- int NUM_EIGHT = 104
-
const
- int NUM_FIVE = 101
-
const
- int NUM_FOUR = 100
-
const
- int NUM_INSERT = 45
-
const
- int NUM_MINUS = 109
-
const
- int NUM_MULTIPLY = 106
-
const
- int NUM_NINE = 105
-
const
- int NUM_NORTH = 38
-
const
- int NUM_NORTH_EAST = 33
-
const
- int NUM_NORTH_WEST = 36
-
const
- int NUM_ONE = 97
-
const
- int NUM_PERIOD = 110
-
const
- int NUM_PLUS = 107
-
const
- int NUM_SEVEN = 103
-
const
- int NUM_SIX = 102
-
const
- int NUM_SOUTH = 40
-
const
- int NUM_SOUTH_EAST = 34
-
const
- int NUM_SOUTH_WEST = 35
-
const
- int NUM_THREE = 99
-
const
- int NUM_TWO = 98
-
const
- int NUM_WEST = 37
-
const
- int NUM_ZERO = 96
-
const
- int O = 79
-
const
- int ONE = 49
-
const
- int OPEN_SQUARE_BRACKET = 219
-
const
CAUTION: This constant requires localization for other locales and keyboard layouts.
- int P = 80
-
const
- int PAGE_DOWN = 34
-
const
- int PAGE_UP = 33
-
const
- int PAUSE = 19
-
const
- int PERIOD = 190
-
const
CAUTION: This constant requires localization for other locales and keyboard layouts.
- int PRINT_SCREEN = 44
-
const
- int Q = 81
-
const
- int QUESTION_MARK = 63
-
const
CAUTION: The question mark is for US-keyboard layouts. It varies for other locales and keyboard layouts.
- int R = 82
-
const
- int RIGHT = 39
-
const
- int S = 83
-
const
- int SCROLL_LOCK = 145
-
const
- int SEMICOLON = 186
-
const
CAUTION: This constant requires localization for other locales and keyboard layouts.
- int SEVEN = 55
-
const
- int SHIFT = 16
-
const
- int SINGLE_QUOTE = 222
-
const
CAUTION: This constant requires localization for other locales and keyboard layouts.
- int SIX = 54
-
const
- int SLASH = 191
-
const
CAUTION: This constant requires localization for other locales and keyboard layouts.
- int SPACE = 32
-
const
- int T = 84
-
const
- int TAB = 9
-
const
- int THREE = 51
-
const
- int TILDE = 192
-
const
CAUTION: This constant requires localization for other locales and keyboard layouts.
- int TWO = 50
-
const
- int U = 85
-
const
- int UNKNOWN = -1
-
const
A sentinel value if the keycode could not be determined.
- int UP = 38
-
const
- int V = 86
-
const
- int W = 87
-
const
- int WIN_IME = 229
-
const
- int WIN_KEY = 224
-
const
- int WIN_KEY_FF_LINUX = 0
-
const
- int WIN_KEY_LEFT = 91
-
const
- int WIN_KEY_RIGHT = 92
-
const
- int X = 88
-
const
- int Y = 89
-
const
- int Z = 90
-
const
- int ZERO = 48
-
const
Static Methods
-
isCharacterKey(
int keyCode) → bool -
Returns true if the keyCode produces a (US keyboard) character. Note: This does not (yet) cover characters on non-US keyboards (Russian, Hebrew, etc.).
Constructors
- KeyCode()