JSFiddle - React, Tailwind, and code Playground

HTML

<span id="count">2:00</span> 

<button type="submit" id="startClock" form="form1"value="Submit">Submit</button>

JavaScript

$('#startClock').click(function(){
    var counter = 20;
  setInterval(function() {
    counter--;
    if (counter >= 0) {
      span = document.getElementById("count");
     var spanz = counter/1000;
      span.innerHTML = Math.floor( );
    }
    if (counter === 0) {
        alert('sorry, out of time');
        clearInterval(counter);
    }
  }, 1000);
    
});