JSFiddle - React, Tailwind, and code Playground
HTML
<table id="teste" style="width:100%">
<tr>
<td>Jill</td>
<td>Smith</td>
<td>50</td>
</tr>
<tr>
<td>Eve</td>
<td>Jackson</td>
<td>94</td>
</tr>
<tr>
<td>John</td>
<td>Doe</td>
<td>80</td>
</tr>
</table>
CSS
.highlight {
background-color: red;
}
JavaScript
$("#teste").on("click", function () {
$("tr").each(function () {
$(this).removeClass('highlight');
})
$(this).parent().addClass('highlight');
});