Last active
October 27, 2022 21:42
-
-
Save tevashov/5172458 to your computer and use it in GitHub Desktop.
Event if and which key was pressed #jQuery
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $(function() { | |
| $(document).keypress(function(e){ | |
| switch(e.which){ | |
| // "ENTER" | |
| case 13: | |
| alert('enter pressed'); | |
| break; | |
| // "s" | |
| case 115: | |
| alert('s pressed'); | |
| break; | |
| (...) | |
| } | |
| }); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment