JSFiddle - React, Tailwind, and code Playground
HTML
<div id="test">
test test
</div>
CSS
div {
width: 300px;
height: 200px;
background-color: #99EAEA;
}
.class-one {
background-color: #EAEAEA;
}
.class-two {
background-color: #EA3355;
}
JavaScript
$(document).ready(function(){
document.oncontextmenu = function() { return false; };
$("#test").click(function() {
$( this ).removeClass("class-two").addClass("class-one");
});
$(document).mousedown(function(e){
if( e.button == 2 ) {
$("#test").removeClass("class-one").addClass("class-two");
return false;
}
return true;
});
});