jQuery 短信验证码倒计时
<!doctype html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Document</title> </head> <body> <button id="btn-vcode" class="btn-vcode sigin_btn form_btn" type="button" style="border:none;">点击获取验证码</button> <script src="https://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"> </script> <script> $(function(){ time($("#btn-vcode")); }); var wait = 60; function time(o) { if (wait == 0) { o.removeAttr("disabled"); o.html('验证码'); wait = 60; } else { o.attr("disabled", "disabled"); o.html(wait + "秒"); wait--; setTimeout(function () { time(o); }, 1000); } } </script> </body> </html>