Html:
<input type= "button" value= "Get Verification Code" >
Css:
1 Input[type=button]{2 width:150px;3 Height:30px;4 Background-color:#ff3000;5 Border:0;6 Border-radius:15px;7 Color:#fff;8}9 Ten Input[type=button].on{ One Background-color:#eee; A Color:#ccc; - cursor:not-allowed; -}
Javascript:
1$ ("input[type= ' button ')"). Click (btncheck);2 3 /**4 * [Btncheck button countdown is often used to get SMS verification code]5 */6 functionbtncheck () {7 8$( This). AddClass ("on");9 Ten varTime = 5; One A$( This). attr ("Disabled",true); - - varTimer = SetInterval (function() { the - if(Time = = 0) { - - clearinterval (timer); + -$ ("input"). attr ("Disabled",false); + A$ ("input"). Val ("Get Verification Code")); at -$ ("input"). Removeclass ("on")); - -}Else { - -$ (' input '). Val (Time + "second")); in -time--; to + } - the}, 1000); * $}
Countdown button-Get Phone Verification code button