JSFiddle - React, Tailwind, and code Playground
by bosworth99
HTML
<div id="yourElement" class="red"></div>
CSS
div#yourElement{
cursor:pointer;
height:100px;
width:100px;
}
div.red{
background-color:red;
}
div.blue{
background-color:blue;
}
JavaScript
$('div#yourElement').bind('mousedown', function() {
$(this).removeClass('red').addClass('blue');
});
$('div#yourElement').bind('mouseup', function() {
$(this).removeClass('blue').addClass('red');
});