当前位置: 移动技术网 > IT编程>开发语言>JavaScript > jquery提交form表单时禁止重复提交的方法

jquery提交form表单时禁止重复提交的方法

2019年03月21日  | 移动技术网IT编程  | 我要评论

jquery提交form表单时禁止重复提交的代码如下:


$(document).ready(function() {
  $('form').submit(function() {
    if(typeof jquery.data(this, "disabledonsubmit") == 'undefined') {
      jquery.data(this, "disabledonsubmit", { submited: true });
      $('input[type=submit], input[type=button]', this).each(function() {
        $(this).attr("disabled", "disabled");
      });
      return true;
    }
    else
    {
      return false;
    }
  });
});

 

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网