当前位置:Gxlcms > JavaScript > jquery提交form表单时禁止重复提交的方法_jquery

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

时间:2021-07-01 10:21:17 帮助过:26人阅读

代码如下:

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

人气教程排行