JSFiddle - React, Tailwind, and code Playground
HTML
<div id="div">button</div>
CSS
#div {
height: 50px;
width: 50px;
background-color: red;
}
JavaScript
$("#div").mousedown(function () {
$(this).css("background-color", "green");
}).mouseup(function () {
$(this).css("background-color", "red");
});