How do I go about binding a function to left and right arrow keys in Javascript and/or jQuery? I looked at the js-hotkey plugin for jQuery (wraps the built-in bind function
$(document).keydown(function(e){ if (e.which == 37) { alert("left pressed"); return false; } });
Character codes:
37 - left 38 - up 39 - right 40 - down
37 - left
38 - up
39 - right
40 - down