Last active
August 29, 2015 14:21
-
-
Save strburst/d6d3786a6e95a763d5b1 to your computer and use it in GitHub Desktop.
Basic key event test page
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() { | |
$('body').keydown(function(event) { | |
console.log('keydown event', event.which); | |
}); | |
$('body').keyup(function(event) { | |
console.log('keyup event', event.which); | |
}); | |
$('body').keypress(function(event) { | |
console.log('keypress event', event.which); | |
$(this).append(String.fromCharCode(event.which)); | |
}); | |
}); |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf8" /> | |
<title>Key Test Page</title> | |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script> | |
<script src="key.js" type="text/javascript"></script> | |
</head> | |
<body> | |
<h1>Key Test Page</h1> | |
<p>Press anything you want.</p> | |
<p id="results"></p> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment