展会信息港展会大全

jquery提交form表单时禁止重复提交的方法
来源:互联网   发布日期:2016-03-24 20:04:27   浏览:1718次  

导读:这篇文章主要介绍了jquery提交form表单时禁止重复提交的方法,需要的朋友可以参考下代码如下:$(document).ready(function() { $(...

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

}

});

});

赞助本站

人工智能实验室

相关热词: 开发 编程 android

AiLab云推荐
展开

热门栏目HotCates

Copyright © 2010-2024 AiLab Team. 人工智能实验室 版权所有    关于我们 | 联系我们 | 广告服务 | 公司动态 | 免责声明 | 隐私条款 | 工作机会 | 展会港