JSFiddle - React, Tailwind, and code Playground

by collabcoders

HTML

<div id="timer"></div>

JavaScript

$(document).ready(function () {
  var secs = 4;
  ticker = setInterval(function(){
    $("#timer").html(secs + " seconds left");
    if (secs == 0) {
        
      //call some function when the clock hits 0
      $("#timer").html("time is up");
        
    }
    secs --;
  }, 1000);
});