I am making a countdown timer with JavaScript.
Here is my script.
var seconds_left = 10;
var interval = setInterval(function() {
    document.getElementById('timer_div').innerHTML = --seconds_left;
    if (seconds_left <= 0)
    {
        //When it gets to 0 second, I want to show 'You are Ready!' text message.
    }
}, 1000);
It starts to count from 10 seconds.
I want to eliminate seconds when it gets 0 second and show a 'You are Ready!' message.
Can anyone help?
var seconds_left = 10;
var interval = setInterval(function() {
    document.getElementById('timer_div').innerHTML = --seconds_left;
    if (seconds_left <= 0)
    {
        document.getElementById('timer_div').innerHTML = 'You are ready';
        clearInterval(interval);
    }
}, 1000);
Here is the Example
document.getElementById('timer_div').innerHTML = "You are Ready!";
                        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