📜  使用 jquery 阻止输入键 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:01:24.580000             🧑  作者: Mango

代码示例3
If keyCode is not caught, catch which:

$('#formid').on('keyup keypress', function(e) {
  var keyCode = e.keyCode || e.which;
  if (keyCode === 13) { 
    e.preventDefault();
    return false;
  }
});