1. Add the ESC event to the entire page:
$ (document). KeyUp (function (event) {
Switch (event.keycode) {
Case 27:
Alert ("ESC");
Case 96:
Alert ("ESC");
}
});
2. Add the ESC event to the specified element:
Trigger the onkeydown event when a keyboard key is pressed KeyCode 0 = KeyCode 1 = KeyCode 2 = KeyCode 3 = KeyCode 4 = KeyCode 5 = KeyCode 6 = KeyCode 7 = KeyCode 8 = BackSpace BackSpace KeyCode 9 = Tab tab KeyCode 10 = KeyCode 11 = KeyCode = Clear KeyCode = Enter KeyCode 14 = KeyCode 15 = KeyCode = shift_l KeyCode = control_l KeyCode = alt_l KeyCode = Pause KeyCode = Caps_lock KeyCode 21 = KeyCode 22 = KeyCode 23 = KeyCode 24 = KeyCode 25 = KeyCode 26 = KeyCode = Escape escape KeyCode 28 = KeyCode 29 = KeyCode 30 = KeyCode 31 = KeyCode = Space Space KeyCode = Prior KeyCode = Next KeyCode = End KeyCode = Home KeyCode PNs = Left KeyCode = up KeyCode = Right KeyCode = Down KeyCode = Select KeyCode = Print KeyCode = Execute KeyCode 44 = KeyCode = Insert KeyCode = Delete KeyCode = Help keycode = 0 Equal braceright keycode = 1 Exclam onesuperior KeyCode = 2 Quotedbl twosuperior keycode = 3 section Threesuperior keycode = 4 Dollar KeyCode = 5 percent KeyCode = 6 Ampersand keycode = 7 Slash braceleft KeyCode = 8 Parenleft bracketleft KeyCode = 9 Parenright bracketright KeyCode 58 = KeyCode 59 = KeyCode 60 = KeyCode 61 = KeyCode 62 = KeyCode 63 = KeyCode 64 = KeyCode = a A KeyCode = b b KeyCode = c C KeyCode = d D KeyCode = e e eurosign KeyCode = f F KeyCode = g g KeyCode = h H KeyCode = i I KeyCode = J J KeyCode = k K KeyCode = l l keycode = M M mu KeyCode = n N keycode = o O KeyCode = P p KeyCode Bayi = q q at KeyCode = r R KeyCode = s S KeyCode = t T KeyCode = u u KeyCode = v V KeyCode = w W KeyCode = x x KeyCode = y y KeyCode = Z Z KeyCode 91 = KeyCode 92 = KeyCode 93 = KeyCode 94 = KeyCode 95 = KeyCode = Kp_0 Kp_0 KeyCode = Kp_1 kp_1 KeyCode 98 = kp_2 kp_2 KeyCode = Kp_3 Kp_3 KeyCode = Kp_4 Kp_4 KeyCode 101 = kp_5 Kp_5 KeyCode 102 = Kp_6 Kp_6 KeyCode 103 = kp_7 kp_7 KeyCode 104 = Kp_8 Kp_8 KeyCode = Kp_9 Kp_9 KeyCode 106 = kp_multiply kp_multiply KeyCode 107 = Kp_add Kp_add KeyCode 108 = Kp_separator Kp_separator KeyCode 109 = kp_subtract Kp_subtract KeyCode = Kp_decimal Kp_decimal KeyCode 111 = kp_divide Kp_divide KeyCode = F1 KeyCode 113 = F2 KeyCode = F3 KeyCode = F4 KeyCode = F5 KeyCode 117 = F6 KeyCode 118 = F7 KeyCode 119 = F8 KeyCode = F9 KeyCode 121 = F10 KeyCode 122 = F11 KeyCode 123 = F12 KeyCode 124 = F13 KeyCode = F14 KeyCode 126 = F15 KeyCode 127 = F16 KeyCode = F17 KeyCode 129 = F18 KeyCode = F19 KeyCode 131 = F20 KeyCode = F21 KeyCode 133 = F22 KeyCode 134 = F23 KeyCode 135 = F24 KeyCode 136 = Num_lock KeyCode 137 = Scroll_lock KeyCode 138 = KeyCode 139 = KeyCode 140 = KeyCode 141 = KeyCode 142 = KeyCode 143 = KeyCode 144 = KeyCode 145 = KeyCode 146 = KeyCode 147 = KeyCode 148 = KeyCode 149 = KeyCode 150 = KeyCode 151 = KeyCode 152 = KeyCode 153 = KeyCode 154 = KeyCode 155 = KeyCode 156 = KeyCode 157 = KeyCode 158 = KeyCode 159 = KeyCode 160 = KeyCode 161 = KeyCode 162 = KeyCode 163 = KeyCode 164 = KeyCode 165 = KeyCode 166 = KeyCode 167 = KeyCode 168 = KeyCode 169 = KeyCode 170 = KeyCode 171 = KeyCode 172 = KeyCode 173 = KeyCode 174 = KeyCode 175 = KeyCode 176 = KeyCode 177 = KeyCode 178 = KeyCode 179 = KeyCode 180 = KeyCode 181 = KeyCode 182 = KeyCode 183 = KeyCode 184 = KeyCode 185 = KeyCode 186 = KeyCode 187 = Acute grave KeyCode 188 = Comma semicolon KeyCode 189 = minus underscore keycode = Period Colon KeyCode 191 = KeyCode 192 = numbersign Apostrophe KeyCode 193 = KeyCode 194 = KeyCode 195 = KeyCode 196 = KeyCode 197 = KeyCode 198 = KeyCode 199 = KeyCode 200 = KeyCode 201 = KeyCode 202 = KeyCode 203 = KeyCode 204 = KeyCode 205 = KeyCode 206 = KeyCode 207 = KeyCode 208 = KeyCode 209 = KeyCode = Plusminus hyphen Macron KeyCode 211 = KeyCode 212 = Copyright Registered KeyCode 213 = Guillemotleft Guillemotright KeyCode 214 = masculine Ordfeminine KeyCode 215 = AE AE KeyCode 216 = cent yen KeyCode 217 = Questiondown Exclamdown KeyCode 218 = Onequarter Onehalf threequarters KeyCode 219 = KeyCode = Less Greater bar KeyCode 221 = plus asterisk Asciitilde KeyCode 222 = KeyCode 223 = KeyCode 224 = KeyCode 225 = KeyCode 226 = KeyCode 227 = Multiply Division KeyCode 228 = Acircumflex Acircumflex KeyCode 229 = Ecircumflex Ecircumflex KeyCode = Icircumflex Icircumflex KeyCode 231 = Ocircumflex Ocircumflex KeyCode 232 = Ucircumflex Ucircumflex KeyCode 233 = Ntilde Ntilde KeyCode 234 = Yacute Yacute KeyCode 235 = Oslash Ooblique KeyCode 236 = aring aring KeyCode 237 = Ccedilla Ccedilla KeyCode 238 = Thorn Thorn KeyCode 239 = ETH ETH KeyCode = diaeresis cedilla currency KeyCode 241 = Agrave Agrave Atilde Atilde KeyCode 242 = Egrave Egrave KeyCode 243 = Igrave Igrave KeyCode 244 = ograve Ograve Otilde Otilde KeyCode 245 = Ugrave Ugrave KeyCode 246 = adiaeresis adiaeresis KeyCode 247 = ediaeresis ediaeresis KeyCode 248 = idiaeresis idiaeresis KeyCode 249 = odiaeresis Odiaeresis KeyCode = Udiaeresis udiaeresis KeyCode 251 = ssharp question Backslash KeyCode 252 = Asciicircum Degree KeyCode 253 = 3 Sterling KeyCode 254 = Mode_switch |
Add keyboard key events, such as ESC events, to the jquery page