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
Example of pure js with going right or left
window.addEventListener('keydown', function (e) { // go to the right if (e.keyCode == 39) { } // go to the left if (e.keyCode == 37) { } });