const getCodeBtn =。。。; let countdown = 60; let intervalId; getCodeBtn.attr("disabled","disabled"); intervalId = setInterval(function () { if (countdown === 0) { getCodeBtn.text("獲取驗證碼"); getCodeBtn.removeAttr("disabled"); clearInterval(intervalId); } else { countdown--; getCodeBtn.text(countdown); getCodeBtn.disabled = true; } }, 1000);