首页 > 代码库 > jquery 获取验证码倒计时

jquery 获取验证码倒计时

<button type="button" class="mui-btn mui-btn-primary mui-btn-outlined mui-pull-right" id="yanzm">获取验证码</button>


$("#yanzm").on(‘click‘,function(){
var num=60;
this.disabled=true;
var self=this

var time=setInterval(function(){
if(num>=0){
$(self).text("发送验证码("+num+")s");
num--
}else{
$(self).text("重新发送");
clearInter(time);
self.disabled=false;
}

},1000)
})

jquery 获取验证码倒计时