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);
posted @ 2017-09-21 20:19  zou1234  阅读(1266)  评论(0)    收藏  举报