jQuery Click to get the verification code button and countdown function

Click the Get Verification Code button -> Call Get Verification Code Interface (Ignore) -> Get the verification code button to switch to the unscrupulous state, the button background color is Gray, the button text is presented as “Countdown] After the number of minutes + can be reabled” -> Countdown 60s After the button recovers the click state, the button background is orange, the button text is presented as “re-send”

2 . Html code

acquisition verification code
    JS code 
// Click to get the verification code operation $ (‘. Feachbtn’). Click (function () {let count = 60; const countdown = setInterval (() => {if (count === 0) {$ (‘. feachbtn’). Text (‘Re-send’) .removeattr (‘disabled’); $ (‘. feachbtn’). CSS ({Background : ‘# ff9400’, Color: ‘#fff’,}; ClearInterval (countdown);} else {$ (‘. feachbtn’). Attr (‘disabled’, true); $ (‘. feachbtn’). CSS ({Background: ‘# D8D8D8’, Color: ‘# 707070’,}); $ (‘. feachbtn’) .Text (count + ‘seconds can be re-acquired);} count-;}, 1000);}});

4. Rendering
   

Summary

It is a small predetermined jQuery click to get the verification code button and countdown, I hope to help everyone. If you have any questions, please leave a message, the small package will reply to everyone. Thank you very much for your support of Tumi Cloud Website! jQuery 点击获取验证码按钮及倒计时功能

© Copyright Notice
THE END
Just support it if you like
like0
share
comment Grab the couch

Please log in to comment