I'm using the jQuery Countdown plugin (http://keith-wood.name/countdown.html), but I can't seem to reset the timer.
When a button is clicked the folowing function starts the countdown:
function startResetCounter() {
$('.reset_counter div').countdown({
until: '+3m +0s',
compact: true,
format: 'MS',
onExpiry: resetPage
});
}
But when I reclick the button it won't reset the timer.
Anyone who can help me out?
Add on top of startResetCounter function following line:
$('.reset_counter div').countdown('destroy'); //remove countdown if it was already used
so at the end you will end up with:
function startResetCounter() {
$('.reset_counter div').countdown('destroy');
$('.reset_counter div').countdown({
until: '+3m +0s',
compact: true,
format: 'MS',
onExpiry: resetPage
});
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With