JSFiddle - React, Tailwind, and code Playground

HTML

<div class="block"></div>

CSS

.block {width:100px;height:100px;background:red;}

JavaScript

var timer;

$(document).ready(function(){
    block = $('.block');
    block.on('mousedown',function(){
           
        timer = setTimeout(function(){ 
           block.html('long click!');
        },500);
    }).on('mouseup',function(){
        
        clearTimeout(timer)
    })
});