JSFiddle - React, Tailwind, and code Playground
by nadeemmnn2007
HTML
<p id="hello">Wait <span id="count">5</span> secs</p>
<input type="button" value="start" id="start" />
JavaScript
$('#start').click(function(){
showTimer(5);
});
function showTimer(tiempo){
setInterval(function() {
tiempo--;
if (tiempo >= 0) {
span = document.getElementById("count");
span.innerHTML = tiempo+'.....';
}
// Display 'counter' wherever you want to display it.
if (tiempo === 0) {
// window.location.reload();
clearInterval(tiempo);
alert('movie starts......');
}
}, 1000);
}