24
I have two input elements, the first is focused, and I want to focus the second by simulating the TAB keypress/keydown event. (Note: I don't want to use .next() or such.)
This is my code, inspired from this question:
$('input').first().focus();
var e = $.Event('keydown');
e.which = 9; // TAB
$(':focus').trigger(e);
Please see http://jsfiddle.net/3PcPH/
The code doesn't work. What is wrong?