-1
My stopwatch is running without format 00:00:00
I created a div in index.html
<!-- TIMER -->
<div class="container">
<span id="display">00:00:00</span>
</div>
No js
static iniciarTimer() {
let time = 0
const timer = document.getElementById(ID_DISPLAY)
// atualizar o texto a cada segundo
const atualizarTexto = () =>
(timer.innerHTML = time++)
atualizarTexto()
const idDoDisplay = setInterval(atualizarTexto, 1000)
return idDoDisplay
}
And start it in another file: main using this.tela.iniciarTimer()
It rotates but without the standard (00:00:00). What should I add, remove or improve?
Need to make some
if
s to verify. Here have an example– Rafael Tavares
I took a look, and I made this code but when leaving the screen it pauses the count.
– Wellnikk
That would be another question. In that have examples in PHP, if you want in Javascript even, with cache, I recommend first try to do and, if not able, create a new question presenting its difficulties.
– Rafael Tavares