JSFiddle - React, Tailwind, and code Playground

by Mohamed Amer

HTML

<div id="clicker"></div>

CSS

#clicker {
    width: 50px;
    height: 50px;
    margin: 20px;
    
    background: orange;
    color: #fff;
    font-size: 24px;
    font-weight: bold;
    font-family: Arial, sans-serif;
}

JavaScript

var timeout, clicker = $('#clicker');
var count = 0;

clicker.mousedown(function(){
	setTimeout(function(){
    timeout = setInterval(function(){
        clicker.text(count++);
    }, 500);
	} , 1000);
    return false;
});