SyntaxFix
Write A Post
Hire A Developer
Questions
Of you want to do it in a single line you can use
$("input").trigger(jQuery.Event('keydown', { which: '1'.charCodeAt(0) }));