JSFiddle - React, Tailwind, and code Playground

HTML

<button  id="t10">XX</button>

JavaScript

var threshold = 10, timeOne, timeTwo;
$('#t10').mousedown(function(){
    timeOne = new Date();
}).mouseup(function(){
    timeTwo = new Date();
    if(timeTwo - timeOne >= 10000){
        alert('Do what you want');
        timeOne = 0;
    }else{
        console.log('Released early');
    }
});