title: Do something on left/right arrow press
body: <p>I want to trigger a click event on another element, when a left or right arrow is pressed. Here is the code:</p>
  <pre><code>$(window).keypress(function (e) {
    var key = e.which;
    if(key == 13 || key == 39) { // the enter key code or right arrow
      $('.next').click();
      return false;  
    } else if(key == 37) { // left arrow
      $('.prev').click();
      return false;  
    }
  });
  </code></pre>
  <p>With <kbd>Enter</kbd> key it works like a charm, however on arrow press, nothing happens, like a Magikarp that uses splash! :) What am I missing?</p>
  <p>Relevant question: <a href="https://stackoverflow.com/questions/26443828/press-left-and-right-arrow-to-change-image">Press left and right arrow to change image?</a></p>