Skip to content

Instantly share code, notes, and snippets.

@SgtPooki
Created April 23, 2013 22:10
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 SgtPooki/5447849 to your computer and use it in GitHub Desktop.
Save SgtPooki/5447849 to your computer and use it in GitHub Desktop.
Simple function to create an object with list of currently pressed keys
var keys = {};
$('#notes')
.live('keydown', function(e){
keys[e.keyCode] = 'down';
console.log(keys);
})
.live('keyup', function(e){
delete keys[e.keyCode];
console.log(keys);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment