Reputation: 4461
I'm using countdown timer from here http://keith-wood.name/countdown.html
I want if my timer is expired it will restart. My implementation below did not restart the timer after expiration. Please help.
HTML
<span id="divtimerholder"></span>
JavaScript
$(document).ready(function() {
startCountdown();
function startCountdown() {
$('#divtimerholder').countdown({ layout: '{mnn} : {snn}', timeSeparator: ':', until: 60, onExpiry: restartCountdown
});
}
function restartCountdown() {
$('#divtimerholder').destroy();
startCountdown();
}
});
JSFiddle http://jsfiddle.net/zD2M2/
Upvotes: 1
Views: 4718
Reputation: 69
$('#divtimerholder').countdown('option', {until: 3});
works like a charm. thanks for the answer LeGEC
Upvotes: 1
Reputation: 51850
Set the option :
$('#divtimerholder').countdown('option', {until: 3});
Upvotes: 7
Reputation: 1442
Looks like the code to unmake a countdown timer should be:
$("#divtimerholder").countdown('destroy');
Upvotes: 1