title: Simulating the TAB keydown: focusing next element as determined by `tabIndex`
body: <p>I have two input elements, the first is focused, and I want to focus the second by simulating the TAB keypress/keydown event. (<em>Note</em>: I don't want to use <code>.next()</code> or such.)</p>
  
  <p>This is my code, inspired from <a href="https://stackoverflow.com/questions/3368578/trigger-a-keypress-keydown-keyup-event-in-js-jquery">this question</a>:</p>
  
  <pre><code>$('input').first().focus();
  
  var e = $.Event('keydown');
  
  e.which = 9; // TAB
  $(':focus').trigger(e);
  </code></pre>
  
  <p>Please see <a href="http://jsfiddle.net/3PcPH/" rel="nofollow noreferrer">http://jsfiddle.net/3PcPH/</a></p>
  
  <p>The code doesn't work. What is wrong?</p>