Skip to content

Instantly share code, notes, and snippets.

@alexcican
Created January 23, 2013 02:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alexcican/4601414 to your computer and use it in GitHub Desktop.
Save alexcican/4601414 to your computer and use it in GitHub Desktop.
Snippet for capturing keyboard keys with Javascript (unfinshed)
$(document).on('keydown', function(e) {
if (e.keyCode >= 65 && e.keyCode <= 90) {
var char = (e.metaKey ? '⌘-' : '') + String.fromCharCode(e.keyCode)
$('#keydown').append('<kbd>' + char + '</kbd>')
e.preventDefault();
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment