http://jsbin.com/xoqizaxecu/edit?html,css,js,output$(".huoqu").on("click",function(){ var $this=$(this);
$this.addClass("gray");var wait=10;
$this.html(wait+"s后獲取"); function fstime(){ if(wait==0){
$(".huoqu").removeClass("gray");
$(".huoqu").text("獲取驗(yàn)證碼");
wait =10;
}else { console.log(wait);
$this.addClass("gray");
$(".gray").html(wait+"s后獲取");
wait--;
}
}
setInterval(fstime,1000);
});<span class="huoqu">獲取驗(yàn)證碼</span>為什么wait還在無(wú)限循環(huán)?console.log 控制臺(tái)里面 0之后又重新繼續(xù)計(jì)算?驗(yàn)證碼邏輯我問(wèn)題出在哪句?如何實(shí)現(xiàn)驗(yàn)證碼業(yè)務(wù)問(wèn)題?
jquery驗(yàn)證碼倒計(jì)思路問(wèn)題
蝴蝶不菲
2018-08-09 11:16:55