Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

152
Vistas
Ending clock like function in js

I tried implementing this clock into a polling app of sorts, problem is that whenever the host clicks a button sending the participants to a new question and starting a new clock, the old ones is still active and the webpage ends up jumping between the two eg 2->41->3->42.

How do I abort this clock with the help of a button press?

var sec = 0;

function pad(val) {
  return val > 9 ? val : "0" + val;
}

setInterval(function() {
  document.getElementById("seconds").innerHTML = pad(++sec);
}, 1000);
<div class="clock">
  <span id="seconds"></span>
</div>

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda