// Set the date we're counting down to var countDownDate = new Date("2022-09-10T05:30:00").getTime(); // Update the count down every 1 second var x = setInterval(function() { var now = new Date().getTime(); // Find the distance between now and the count down date var distance = countDownDate - now; var days = Math.floor(distance / (1000 * 60 * 60 * 24)); var hrs = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)); var mins = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60)); var secs = Math.floor((distance % (1000 * 60)) / 1000); document.getElementById('days').innerHTML = days document.getElementById('hrs').innerHTML = hrs document.getElementById('mins').innerHTML = mins document.getElementById('secs').innerHTML = secs // If the count down is finished, hide the count down, display results if (distance < 0) { clearInterval(x); document.getElementsByClassName("before-race-container").style.display = "none"; //put logic in to display results iframe here } }, 1000);