JSFiddle - React, Tailwind, and code Playground
by Minko Gechev
HTML
<table>
<tr>
<td>
<input type="checkbox" id="checkbox" />
</td>
<td>
Hello
</td>
<td>
my friend!
</td>
</tr>
</table>
JavaScript
document.getElementById('checkbox').onchange = function () {
var row = this.parentNode.parentNode;
if (this.checked) {
row.style.backgroundColor = 'red';
} else {
row.style.backgroundColor = 'transparent';
}
};