The most correct one:
$(document).keyup(function(event){ if(event.keyCode ==13){ $("#submit").trigger("click"); } });
This case, to get the focus when the input, in order to listen to keyboard events:
$("input").keydown(function(){ ... })
The most correct one:
$(document).keyup(function(event){ if(event.keyCode ==13){ $("#submit").trigger("click"); } });
This case, to get the focus when the input, in order to listen to keyboard events:
$("input").keydown(function(){ ... })