×

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

作者:Terry2017.02.10来源:Web前端之家浏览:10681评论:0
关键词:JQueryJS

复制代码 代码如下:

$(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;
    }
  });
});

您的支持是我们创作的动力!
温馨提示:本文作者系Terry ,经Web前端之家编辑修改或补充,转载请注明出处和本文链接:
https://jiangweishan.com/article/svg1486656000811.html

网友评论文明上网理性发言已有0人参与

发表评论: