JSFiddle - React, Tailwind, and code Playground
HTML
<table id="table">
<tr><td><input type="checkbox" name="sth" value="1">1</td><td>another td</td></tr>
<tr><td><input type="checkbox" name="sth" value="2">2</td><td>another td</td></tr>
</table>
CSS
.newclass {
background-color: #ffff00;
}
JavaScript
all_tds = $('#table td');
$(function () {
$('input:checkbox').on('change', function () {
all_tds.removeClass("newclass");
if (this.checked) {
$(this).parent().siblings("td").addClass("newclass");
}
});
$('input:checkbox').click(function(){
if($(this).is(':checked')){
$('input:checkbox').not(this).prop('checked', false);
}
});
});