您现在的位置: 万盛学电脑网 >> 程序编程 >> 脚本专题 >> javascript >> 正文

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

作者:佚名    责任编辑:admin    更新时间:2022-06-22

 这篇文章主要介绍了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;     }   }); });