JSFiddle - React, Tailwind, and code Playground
HTML
<table border="0" id="theTable">
<tr>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
</tr>
</table>
CSS
#theTable {
border-collapse: collapse;
}
#theTable td {
border: 1px solid silver;
width: 100px;
height: 20px;
}
JavaScript
var table = document.getElementById("theTable");
for (var i = 0; i<table.rows.length; i++) {
table.rows[i].onclick = function () {
this.style.background = "lavender";
}
}