JSFiddle - React, Tailwind, and code Playground

by axman

HTML

<input type="text" id="iTime" >
<input type="button" name="btn" id="btnStart" value="Start" >
<input type="button" name="btn" id="btnStop" value="Stop" >

JavaScript

var tm;
$(function() {
    $('#btnStart').click(function() {       
        tm = window.setInterval(function() {            
            var dt= new Date();
            var str=dt.toLocaleTimeString();
            $('#iTime').val(str);       
        },1000);
    });
     $('#btnStop').click(function() {
         window.clearInterval(tm);
    });
});