短信倒计时
//html
<input type="button" value="获取验证码" class="sentBtn">
//css
/* 发送按钮禁止样式 */
.sentBtn.disabled {
background-color:#CCC !important;
cursor:not-allowed !important;
}
/* 发送按钮样式 */
.sentBtn {
min-width:100px;
padding:5px;
border:none;
color:#FFF;
background-color:#83EBF0;
border-radius:4px;
cursor:pointer;
}
$('.sentBtn').click(function() {
$(this).addClass("disabled");
var time = 60;
var $this = $(this);
var timer = setInterval(function() {
time--;
if (time == 0) {
clearInterval(timer);
$this.val('获取验证码');
$this.removeClass("disabled");
return;
}
$this.val('还剩' + time + "秒");
}, 1000);
});