携帯電話認証コード

836 ワード

     
js:
//     
     $(".obtain-code").click(function() {
          $(this).css('color', '#757575');
          settime(this);
     });
     var countdown = 60;
     function settime(obj) {
          if(countdown == 0) {
              obj.removeAttribute("disabled");
              obj.innerHTML = "       ";
              $('.obtain-code').css('color', '#14C58E');
              countdown = 60;
              return;
          } else {
              obj.setAttribute("disabled", true);
              obj.innerHTML = "" + countdown + " ";
              countdown--;
          }
          setTimeout(function() {
              settime(obj);
          }, 1000)
     }