我在将此脚本绑定(bind)到提交按钮时遇到问题...
$('input').on('keydown', function(event) {
var x = event.which;
if (x === 13) {
event.preventDefault();
}
});
我以前做过,但已经很长时间了,而且网络上的示例并不适合我。谢谢:)
最佳答案
jQuery(function($) { // DOM is now ready
// your code here
});
应该可以解决问题。
https://learn.jquery.com/using-jquery-core/document-ready/
关于javascript - 将 javascript 绑定(bind)到提交按钮时遇到问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36298427/