JSFiddle - React, Tailwind, and code Playground

HTML

<input type=text id="text2">
<div id="div1"></div><br>
<input type=button id="but1" value="Включить SetInterval"
onClick="my_click_but1(event);">
<input type=button id="but2" value="Выключить SetInterval"
onClick="my_click_but2(event);"><br><br>

JavaScript

var $rot=0;
  var $tim3;
  var c=0;
  var t;
  var timer_is_on=0;


function my_click_but1($event) 

{if($tim3) { clearInterval($tim3);$tim3=setInterval("rotinp(5);",1000);} else {$tim3=setInterval("rotinp(5);",1000);}
}

function my_click_but2($event)
{ clearInterval($tim3);}

function rotinp($pl) 
{$rot=$rot+$pl;
document.getElementById('text2').style.transform="rotate("+$rot+"deg)";
}