javascript:验证码倒计时60s

验证码倒计时60秒,并且60秒内不能再点击
function getIc(a){
$('#'+a).removeAttr('onclick');
let ict=60;
var closey = setInterval(function(){
ict = ict - 1;
console.log(ict);
$('#'+a).text("重新发送" + ict);
$('#'+a).css("background-color" , "#e3e3e3");
if(ict <=0 ){
clearInterval(closey);
$('#'+a).text("获取验证码");
$('#'+a).attr('onclick',"getIc(id)");
}
},1000);
}

猜你喜欢

转载自www.cnblogs.com/llqwm/p/9144841.html