JSFiddle - React, Tailwind, and code Playground
HTML
<div class="box">1</div>
CSS
.box {
width :100px;
height: 100px;
background: red;
}
JavaScript
var mytimeout, i;
i = $('.box').text();
$('.box').on('mouseenter', function() {
if(mytimeout) {
clearInterval(mytimeout);
}
}).on('mouseleave', function() {
mytimeout = setInterval(function() {
$('.box').text(i++);
},1000);
});