js短信验证码时间

短信验证码时间

比较简单直接上代码:

var wait = 60;
timeOut();
function timeOut() {
  if (wait == 0) {
    $('#code').text("重新获取验证码");
  } else {
    setTimeout(function () {
      wait--;
      $('#code').text(wait);
      timeOut();
    }, 1000)
  }
}

猜你喜欢

转载自www.cnblogs.com/summarize/p/8983906.html