Enter the trigger button event jQuery implementation (Enter phone keypad as triggers)

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(){
...
})


Guess you like

Origin www.cnblogs.com/yinmu/p/11009514.html