var step = 59; var _res = setInterval(function () { $(".sendSms").attr("disabled", true);//设置disabled属性 $('.sendSms').text('重新发送' + step + '秒'); step -= 1; if (step <= 0) { $(".sendSms").removeAttr("disabled"); //移除disabled属性 $('.sendSms').text('获取验证码'); clearInterval(_res);//清除setInterval } }, 1000);