表单->;有没有办法禁用回车键,让他们必须点击提交


forms->is there a way to disable the enter key so they have to click submit

我的情况是,我想使用输入文本,但需要禁用回车键。要提交表格,他们必须点击提交按钮。

有没有一种方法可以禁用输入,这样它就不会提交?

感谢

在提交按钮上,绑定以下代码:

$('input').on('keydown', function(event) {
   var x = event.which;
   if (x === 13) {
       event.preventDefault();
   }
});