JSFiddle - React, Tailwind, and code Playground

by Neo Aptt

HTML

<button id="button" type="button">Test</button>MilliSeconds: <span id="output"></span>

JavaScript

var start = 0;
$('#button').mousedown(function () {
    start = $.now();
});
$('#button').mouseup(function () {
    end = $.now();
    $('#output').html(end - start);
    if (end - start > 1000) {
        alert('you just held the mouse for 1 second');
    }
});