[英]Disable submit form button when the timer stops Javascript Html
大家早上好。 嗨,我這里有我的示例javascript和html代碼。 我要的是計時器停止運行或完成“提交”按鈕時將禁用,以便用戶無法提交其表單。 我目前正在開發小型投票系統。
這是我的代碼:
Java腳本
var callbackfunction = function () { console.log('Done!'); } countdown('12/10/2017 06:26:00 AM', ['days', 'hours', 'minutes', 'seconds'], callbackfunction);
我有操作計時器的count.js。
最后是我的HTML代碼:
<input type="submit" name="submit" value="Submit" class="submit-query">
<table style="margin: 0 auto;"> <tr> <td class="header-tb" id="days">00</td> <td class="header-tb" id="hours">00</td> <td class="header-tb" id="minutes">00</td> <td class="header-tb" id="seconds">00</td> </tr> </table>
我只想在時間結束后停止用戶嘗試提交。 我的代碼構造有可能嗎?
您可以嘗試類似:
if(timer >= 3600) {
document.getElementById('your-button').disabled = true;
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.