JSFiddle - React, Tailwind, and code Playground
HTML
<table>
<tr>
<td id="myrowID">My text</td>
</tr>
</table>
JavaScript
function mouseHandler(event) {
if( event.button == 2){
this.style.backgroundColor = "red";
rightFunc();
} else{
this.style.backgroundColor = "blue";
otherFunc();
}
}
function rightFunc(){ alert("rightclick");}
function otherFunc(){ alert("left or wheel");}
document.getElementById("myrowID").addEventListener("mousedown", mouseHandler);