1:页面中如果存在input输入框和submit提交按钮时,默认按enter键会提交表单,如果我现在在做查询操作,一不小心按了enter键就会有提交表单的操作,这样显然是不合理的,所以我们要禁止按enter键时,提交表单。

2:jquery下的代码,禁止enter键提交表单。

$(document).keydown(function(event){
  switch(event.keyCode){
    case 13:return false;
  }
});

相关文章:

  • 2022-12-23
  • 2021-08-19
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-06-23
  • 2022-12-23
  • 2021-07-29
  • 2022-12-23
  • 2022-12-23
  • 2021-09-01
相关资源
相似解决方案