Created
March 2, 2015 23:56
-
-
Save bmoren/1c9968150644ca37db3d to your computer and use it in GitHub Desktop.
Jquery Keypress Event
This file contains 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(){ //jq do some work! - when ever the DOM is ready, do the stuff in here! | |
$(document).keypress(function(e) { // look at the keypressed | |
if(e.which == 97) { // use some logic to see what key was pressed | |
alert('You pressed "A"!'); //do something when that key was pressed | |
} | |
}); | |
///////USE BELOW TO FIGURE OUT KEY NUMBERS! | |
$(document).keypress(function(e) { | |
console.log("keypressed: " + e.which); | |
}); | |
}); // stop doing jquery sutff |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment