0
I am creating a function to start a count and when it reaches the final stop value. However the clearInterval
is not working.
Has anyone ever had to do anything like this?
function numerosHome() {
var inicial = 0;
var location = document.getElementById('participantes');
setInterval(() => {
location.innerHTML = inicial;
inicial++;
if (inicial == 10) {
clearInterval();
}
}, 100);
}
numerosHome()
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.2.3/jquery.min.js"></script>
<div class="numeros" id="participantes">
</div>