Am mit einem Countdown-Timer arbeiten, und ich will es stoppen, wenn 0 ist, ist hier mein CodeWie Timer Countdown stoppen
function countdown() {
// your code goes here
var count = $('.c').attr('id');
var timerId = setInterval(function() {
count--;
$('.c').text(count)
if (count == 0) {
$("#page").load("page.php");
$('#beforeloading').html('');
count = 60;
}
}, 1000);
}
Sie können 'clearInterval (intervalName)' – Keatinge
Sie wirklich Ihre erste 'count' von einem' id' des Elements erhalten? –
Mögliches Duplikat von [Stop setInterval Aufruf in JavaScript] (https://stackoverflow.com/questions/109086/stop-setinterval-call-in-javascript) – evilReiko