JSFiddle - React, Tailwind, and code Playground
by gbsandeep
HTML
<input type="button" id="start" value="start" />
<input type="button" id="stop" value="stop" />
JavaScript
var eGi = {};
$('#start').click(function start() {
var somethingElse = confirm("start interval?");
if (somethingElse) {
eGi.cycle1 = setInterval(function(){
console.log('Running...');
},1000);
}
});
$('#stop').click(function stop(){
clearInterval(eGi.cycle1);
});