countdown timer secondshttps://jsfiddle.net/pseudorad10/78yqpv4f/#save

start button disables while timer runs. When timer is finished it resets values and enables start button

by Mark Hendricks

HTML

<span id="minutes">00</span>:<span id="seconds">15</span>
<span id="timeUp">false</span><button id="start" onClick="startTimer();">Start!</button>

JavaScript

var sec = 0;
var max = 15; // # of seconds to count down
var maxms = max * 1000;
var timeUp = false;

document.querySelector('#start').disabled = false;

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

function startTimer() {
	timeUp = false;
	document.querySelector('#start').disabled = true;
  var timer = setInterval(function () {
      let seconds = ++sec % 60;
      let countdown = max - seconds;
      if (seconds == max) {
        timeUp = true;
        document.querySelector('#start').disabled = false;
        sec=0;
        countdown=30;
      }
      document.getElementById("seconds").innerHTML = pad(countdown);
      // document.getElementById("timeUp").innerHTML = timeUp;
  }, 1000);


  setTimeout(function () {
      clearInterval(timer);
  }, maxms);
}