jQuery 点击获取验证码按钮及倒计时功能

1.具体思路

点击获取验证码按钮 —> 调用获取验证码接口(忽略)—>获取验证码按钮切换到不可点击状态,按钮背景色呈灰色,按钮文字呈现为“倒计时秒数+后可重新获取”—> 倒计时60s后按钮恢复可点击状态,按钮背景呈橙色,按钮文字呈现为“重新发送”

2.HTML代码

rush:js;">

3.JS代码

{ if (count === 0) { $('.feachBtn').text('重新发送').removeAttr('disabled'); $('.feachBtn').css({ background: '#ff9400',color: '#fff',}); clearInterval(countDown); } else { $('.feachBtn').attr('disabled',true); $('.feachBtn').css({ background: '#d8d8d8',color: '#707070',}); $('.feachBtn').text(count + '秒后可重新获取'); } count--; },1000); } });

4.效果

imsun; white-space: normal; word-spacing: 0px; text-transform: none; font-weight: normal; color: rgb(0,0); font-style: normal; text-align: center; orphans: 2; widows: 2; letter-spacing: normal; text-indent: 0px; font-variant-ligatures: normal; font-variant-caps: normal; -webkit-text-stroke-width: 0px">

imsun; white-space: normal; word-spacing: 0px; text-transform: none; font-weight: normal; color: rgb(0,0); font-style: normal; text-align: center; orphans: 2; widows: 2; letter-spacing: normal; text-indent: 0px; font-variant-ligatures: normal; font-variant-caps: normal; -webkit-text-stroke-width: 0px">

imsun; white-space: normal; word-spacing: 0px; text-transform: none; font-weight: normal; color: rgb(0,0); font-style: normal; text-align: center; orphans: 2; widows: 2; letter-spacing: normal; text-indent: 0px; font-variant-ligatures: normal; font-variant-caps: normal; -webkit-text-stroke-width: 0px">

总结

以上所述是小编给大家介绍的jQuery 点击获取验证码按钮及倒计时。编程之家 jb51.cc 收集整理的教程希望能对你有所帮助,如果觉得编程之家不错,可分享给好友!感谢支持

相关文章

页面搜索关键词突出 // 页面搜索关键词突出 $(function () {...
jQuery实时显示日期、时间 html: <span id=&quot...
jQuery 添加水印 <script src="../../../.....
中文:Sys.WebForms.PageRequestManagerParserErrorExceptio...
1. 用Response.Write方法 代码如下: Response.Write(&q...
Jquery实现按钮点击遮罩加载,处理完后恢复 思路: 1.点击按...