验证码倒计时60秒的JS代码

来自:互联网
时间:2019-08-24
阅读:
免费资源网 - https://freexyz.cn/
<script src="../../public/jquery.js"></script>
<h4>验证码</h4>
<div class="regin_yan_bac">
   <input type="password">
   <button class="sms_click">发送验证码</button>
</div>
<script>
   //获取验证码
   var wAIt = 60;
   function countdown(timeer) {
     var $timeer = $(timeer)
     if (wait == 0) {
       $timeer.attr("disabled", false);
       $timeer.html("发送验证码")
       wait = 60;
     } else {
       $timeer.attr("disabled", true);
       $timeer.html(+wait + "秒后获取");
       wait--;
       setTimeout(function () {
          countdown(timeer)
       }, 1000);
   }
}
$(".sms_click").on("click", function () {
   countdown(this);
})
</script>
免费资源网 - https://freexyz.cn/
返回顶部
顶部