Pomodoro Clock_Help Requested_Reset Button

Hello. I wondered if I could get some help. I’m unsure of how to reset the timer. I’ve got the start and stop buttons down. Just not sure how to approach this problem. Thanks.

Try something like this:

  $('#reset').on('click', function() {
    clearInterval(time);
    counter = 0;
    timeLeft = 25*60;
    timer.html(convertSeconds(timeLeft-counter));
  });

Thanks! Something unusual happens if I click on start more than once in a row. The timer speeds up and then I cannot stop or reset it. Can I code in instructions that say one cannot click on the button more than once in a row?

Hi,

Just write this:

 if(!time) 
    time = setInterval(timeIt, 1000);

Otherwise you’re setting a new interval each time.

Thanks! Works great now.

1 Like