JSFiddle - React, Tailwind, and code Playground
HTML
<div id="timer"></div>
<a id="start" >start<a>
<a id="stop">stop<a>
JavaScript
$(document).ready(function(){
var handler = null;
var startTime = 0;
function startTimer(){
startTime = (new Date()).getTime();
handler = setInterval(function(){showTime()},1000);
}
function showTime(){
var senconds = ((new Date()).getTime() - startTime)/1000 + 's';
$('#timer').text(senconds);
}
function stopTimer(){
clearInterval(handler);
}
$('#start').click(startTimer);
$('#stop').click(stopTimer);
});