jquery 实现倒计时60秒并清除定时器
jquery 实现倒计时60秒并清除定时器
var wait=60; $('#AutoCode').text(wait+'s'); timer = setInterval(function(){ if(wait==0){ $('#AutoCode').text('获取验证码'); clearInterval(timer) }else{ wait--; $('#AutoCode').text(wait+'s'); } },1000);
var wait=60; $('#AutoCode').text(wait+'s'); timer = setInterval(function(){ if(wait==0){ $('#AutoCode').text('获取验证码'); clearInterval(timer) }else{ wait--; $('#AutoCode').text(wait+'s'); } },1000);