Your code associates a callback with an event focus, but does not actually focus the element. You can save it as a callback and manually focus the element, or just start it after focus:
Edited by; thanks @ GNi33 for pointing out the re-binding!
var $input = $('form input:first');
$input.focus(function(){
console.log('done focus');
});
$('a.focus').click(function(){
$input.focus();
});
source
share