在引導程序中,我使用了一個jquery倒計時插件,當時間等於00周00天時,我需要將我的類從label-default更改爲lable-danger。00: 00:00如何在jquery中更改倒數計時器的類,當它爲零時
<!--this element class i want to change-->
<span id="sp-dt-<?php echo $row['id']; ?>" class="label label-default"></span>
<!--This is my countdown plugin-->
<script type="text/javascript">
$('#sp-dt-<?php echo $row["id"]; ?>').countdown('<?php echo $expDate; ?>', function(event) {$(this).html(event.strftime('%w weeks %d days %H:%M:%S'));
});
爲u可以在圖片中看到,當時間來到00周00天00:00:00我想從標籤dafault改變類標籤的危險
說明:
- 我用
getElementById
但jquery
文件倒計時和jquery CDN
相互矛盾,因此給予「未捕獲的錯誤」。 - 我也嘗試使用
$('#sp-dt-<?php echo $row["id"]; ?>').val() = 00 weeks 00 days 00:00:00
,但它不工作
試試'$('#sp-dt - <?php echo $ row [「id」]; ')。')。text()==「00 weeks 00 days 00:00:00」' –
[Jquery Countdown on finish callback]可能的重複(http://stackoverflow.com/questions/31182732/jquery-countdown- on-finish-callback) –
你使用了什麼倒計時插件? – crashwap