JSFiddle - React, Tailwind, and code Playground
by ChrisStanyon
HTML
<div id="timer">
<div class="wrapper1">
<h2>05</h2>
</div>
</div>
<div id="message">
This is the message
</div>
CSS
#message { display: none; }
JavaScript
let countdown = 5;
const interval = setInterval(() => {
--countdown;
document.getElementById('timer').firstElementChild.firstElementChild .innerHTML = countdown.toLocaleString('en-GB', {
minimumIntegerDigits: 2
});
if (countdown <= 0)
{
//window.location.replace("https://stanyon.co.uk");
document.getElementById('timer').style.display = 'none';
document.getElementById('message').style.display = 'block';
clearInterval(interval);
}
}, 1000);