js: 阻止按enter键提交表单

 

 <input type="button" id="contact" class="btn btn-danger auto-save" value="Confirm to Delete" disabled>

 

  $("#contact").bind("keypress keydown keyup", function (e) {
            if (e.keyCode == 13) {
                event.preventDefault();
                return false;
            }
        })

 

posted @ 2022-07-07 11:30  katesharing  阅读(234)  评论(0)    收藏  举报