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

201
Vistas
How do I "clear" my timer using my clear button?

I am new to javascript. I am trying to clear my timer value on clcking the"clear" button.I tried to use the variable"sec" from myTimer function, but it is not working. Any suggestions? Help is appreciated.

about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

the document.getElementsByTagName gets the button and runs the function when clicked.

let timer;
let increment = 0;

timer = setInterval(() => increment++ , 1000)

//gets the button element and clears timer when clicked
document.getElementsByTagName("button").onclick = function() {
    clearInterval(timer)
}
about 4 years ago · Juan Pablo Isaza Denunciar

0

let count = 0
let myTimer;

// set timer
myTimer = setInterval(() => count = count + 1 , 1000)

// clear timer
clearInterval(myTimer)

Show the code of your timer so that I can describe the solution in more detail

about 4 years ago · Juan Pablo Isaza Denunciar
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