前端防止重复提交btnLimit.js
2021-03-22 05:27
标签:class event dev function set this nbsp settime div 前端防止重复提交btnLimit.js 标签:class event dev function set this nbsp settime div 原文地址:https://www.cnblogs.com/bevis-byf/p/12706623.html$(function() {
$(".btn").each(function() {
$(this)[0].addEventListener(‘click‘, function() {
$(this).css("pointer-events", "none");
setTimeout(function() {
$(".btn").css("pointer-events", "auto");
}, 500);
});
});
var mm = setInterval(function() {
var blen = $("body .layui-layer-btn1").length;
$("body .layui-layer-btn1").each(function() {
$(this)[0].addEventListener(‘click‘, function() {
$(this).css("pointer-events", "none");
setTimeout(function() {
$("body .layui-layer-btn1").css("pointer-events", "auto");
}, 5000);
});
});
if (blen > 0) {
clearInterval(mm);
}
}, 20);
})