Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

150
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!