表单重复提交解决(是自定义属性实现)

$("#submit").click(function () {
var nowTime = new Date().getTime();
var clickTime = $(this).attr("ctime");
if (clickTime != 'undefined' && (nowTime - clickTime < 10000)) {
alert('操作过于频繁,稍后再试');
return false;
} else {
$(this).attr("ctime", nowTime);
var mainForm = $("#submit").parent().parent();
mainForm.submit(function () {
if (mainForm.valid()) {
$("#submitloading").show();

} else {
$(".validation-summary-errors").hide(8000);
}


});
}
});

原文地址:https://www.cnblogs.com/hzsu/p/6306468.html