JS 60秒后重发送验证码

//settime($("#getPhoneCode"),60);

function settime($obj, time) {
    if (time == 0) {
        $obj.attr("disabled", false);
        $obj.css("background", "#f38401").css("cursor", "pointer");
        $obj.text("获取手机验证码"); 
        return;
    } else {
        $obj.attr("disabled", true);
        $obj.css("background", "#ccc").css("cursor", "not-allowed");
        $obj.text("重新发送(" + time + ")");
        time--;
    }
    setTimeout(function () { settime($obj, time) }, 1000)
}
原文地址:https://www.cnblogs.com/valeb/p/7235692.html