JSFiddle - React, Tailwind, and code Playground

HTML

<button>Click Me</button>

JavaScript

var timeOut;
$("button").mouseup(function(event){
    
    clearTimeout(timeOut);
});
$("button").mousedown(function(event){
    
    timeOut = setTimeout(function(){
        
    	alert('you hold your mouse more than 2 seconds.!');
      
    },2000);
});