1backspace 8
2tab 9
3enter 13
4shift 16
5ctrl 17
6alt 18
7pause/break 19
8caps lock 20
9escape 27
10page up 33
11Space 32
12page down 34
13end 35
14home 36
15arrow left 37
16arrow up 38
17arrow right 39
18arrow down 40
19print screen 44
20insert 45
21delete 46
220 48
231 49
242 50
253 51
264 52
275 53
286 54
297 55
308 56
319 57
32a 65
33b 66
34c 67
35d 68
36e 69
37f 70
38g 71
39h 72
40i 73
41j 74
42k 75
43l 76
44m 77
45n 78
46o 79
47p 80
48q 81
49r 82
50s 83
51t 84
52u 85
53v 86
54w 87
55x 88
56y 89
57z 90
58left window key 91
59right window key 92
60select key 93
61numpad 0 96
62numpad 1 97
63numpad 2 98
64numpad 3 99
65numpad 4 100
66numpad 5 101
67numpad 6 102
68numpad 7 103
69numpad 8 104
70numpad 9 105
71multiply 106
72add 107
73subtract 109
74decimal point 110
75divide 111
76f1 112
77f2 113
78f3 114
79f4 115
80f5 116
81f6 117
82f7 118
83f8 119
84f9 120
85f10 121
86f11 122
87f12 123
88num lock 144
89scroll lock 145
90My Computer (multimedia keyboard) 182
91My Calculator (multimedia keyboard) 183
92semi-colon 186
93equal sign 187
94comma 188
95dash 189
96period 190
97forward slash 191
98open bracket 219
99back slash 220
100close braket 221
101single quote 222
1$('#someTextBox').keypress(function(event){
2 var keycode = (event.keyCode ? event.keyCode : event.which);
3 if(keycode == '13'){
4 alert('You pressed a "enter" key in textbox');
5 }
6});
7
1Easily check JavaScript KeyboardEvent properties (e.key, e.code, e.which,
2e.keyCode… and more) with Key.js:
3
4https://keyjs.dev
5
6Key Code | Key Description
7----------------------------
80 | Unidentified key
91 |
102 |
113 |
124 |
135 |
146 |
157 |
168 | Backspace
179 | Tab
1810 |
1911 |
2012 | Clear
2113 | Enter
2214 |
2315 |
2416 | Shift
2517 | Control
2618 | Alt
2719 | Pause/Break
2820 | Caps Lock
2921 |
3022 |
3123 |
3224 |
3325 |
3426 |
3527 | Escape
3628 |
3729 |
3830 |
3931 |
4032 | Space Bar
4133 | Page Up
4234 | Page Down
4335 | End
4436 | Home
4537 | Left Arrow
4638 | Up Arrow
4739 | Right Arrow
4840 | Down Arrow
4941 | Select
5042 | Print
5143 | Execute
5244 | Print Screen / Snapshot
5345 | Insert
5446 | Delete
5547 | Help
5648 | 0
5749 | 1
5850 | 2
5951 | 3
6052 | 4
6153 | 5
6254 | 6
6355 | 7
6456 | 8
6557 | 9
6658 |
6759 |
6860 |
6961 |
7062 |
7163 |
7264 |
7365 | A
7466 | B
7567 | C
7668 | D
7769 | E
7870 | F
7971 | G
8072 | H
8173 | I
8274 | J
8375 | K
8476 | L
8577 | M
8678 | N
8779 | O
8880 | P
8981 | Q
9082 | R
9183 | S
9284 | T
9385 | U
9486 | V
9587 | W
9688 | X
9789 | Y
9890 | Z
9991 | Left Window/Meta/OS Key
10092 | Right Window/Meta/OS Key
10193 | Context Menu
10294 |
10395 |
10496 | Numpad 0
10597 | Numpad 1
10698 | Numpad 2
10799 | Numpad 3
108100 | Numpad 4
109101 | Numpad 5
110102 | Numpad 6
111103 | Numpad 7
112104 | Numpad 8
113105 | Numpad 9
114106 | Multiply
115107 | Add
116108 | Keypad Enter
117109 | Subtract
118110 | Decimal Point
119111 | Divide
120112 | F1
121113 | F2
122114 | F3
123115 | F4
124116 | F5
125117 | F6
126118 | F7
127119 | F8
128120 | F9
129121 | F10
130122 | F11
131123 | F12
132124 | F13
133125 | F14
134126 | F15
135127 | F16
136128 | F17
137129 | F18
138130 | F19
139131 | F20
140132 | F21
141133 | F22
142134 | F23
143135 | F24
144136 | F25
145137 | F26
146138 | F27
147139 | F28
148140 | F29
149141 | F30
150142 | F31
151143 | F32
152144 | Num Lock
153145 | Scroll Lock
154146 |
155147 |
156148 |
157149 |
158150 |
159151 |
160152 |
161153 |
162154 |
163155 |
164156 |
165157 |
166158 |
167159 |
168160 |
169161 |
170162 |
171163 |
172164 |
173165 |
174166 | Navigate/Page Back
175167 | Navigate/Page Forward
176168 | Reload/Refresh Page
177169 |
178170 |
179171 |
180172 |
181173 |
182174 | Audio Volume Down
183175 | Audio Volume Up
184176 |
185177 |
186178 |
187179 |
188180 |
189181 |
190182 |
191183 |
192184 |
193185 |
194186 | Semi-colon
195187 | Equal Sign
196188 | Comma
197189 | Dash
198190 | Period
199191 | Forward Slash
200192 | Grave Accent
201193 |
202194 |
203195 |
204196 |
205197 |
206198 |
207199 |
208200 |
209201 |
210202 |
211203 |
212204 |
213205 |
214206 |
215207 |
216208 |
217209 |
218210 |
219211 |
220212 |
221213 |
222214 |
223215 |
224216 |
225217 |
226218 |
227219 | Open Bracket
228220 | Back Slash
229221 | Close Bracket
230222 | Single Quote
231223 |
232224 |
233225 |
234226 |
235227 |
236228 |
237229 |
238230 |
239231 |
240232 |
241233 |
242234 |
243235 |
244236 |
245237 |
246238 |
247239 |
248240 |
249241 |
250242 |
251243 |
252244 |
253245 |
254246 |
255247 |
256248 |
257249 |
258250 |
259251 |
260252 |
261253 |
262254 |
263255 |