type='sumbit'时默认enter键提交表单

但如果用的是ajax提交时,type="button",enter键提交不了,所以只好用js去捕捉onkeydown事件~

document.onkeydown = function(e){
e
= e || window.event;
if(e.keyCode === 13){
//这里放你的代码
}
};

相关文章:

  • 2021-11-21
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-07-29
  • 2021-09-01
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-26
相关资源
相似解决方案