JSFiddle - React, Tailwind, and code Playground

HTML

<div></div>

CSS

div {
    width: 100px;
    height: 100px;
    background-color: green;
}

JavaScript

$('div').on('mousedown mouseup', function mouseState(e) {
        if (e.type == "mousedown") {
            //code triggers on hold
            console.log("hold");
        }
    });