JSFiddle - React, Tailwind, and code Playground
HTML
<form id="form1" name="form1" method="post" action="">
<table width="500" border="1" cellspacing="0" cellpadding="5" id="searchResults">
<tr>
<td> </td>
<td><strong>FirstName</strong></td>
<td><strong>LastName</strong></td>
<td><strong>Address</strong></td>
</tr>
<tr>
<td><input type="checkbox" name="selections[]" value="1" /></td>
<td>Joe</td>
<td>Schmo</td>
<td>123 Dummy Drive</td>
</tr>
<tr>
<td><input type="checkbox" name="selections[]" value="1" /></td>
<td>Some</td>
<td>Dude</td>
<td>4567 Bogus Boulevard</td>
</tr>
<tr>
<td><input type="checkbox" name="selections[]" value="1" /></td>
<td>Eddie</td>
<td>Example</td>
<td>890 Lorum Ipsom Lane</td>
</tr>
</table>
</form>
CSS
.active {
background-color:#e5f5ff;
}
JavaScript
$(document).ready(function () {
$('#searchResults tr').click(function (event) {
if (event.target.type !== 'checkbox') {
$(':checkbox', this).trigger('click');
}
});
$("input[type='checkbox']").change(function (e) {
if ($(this).is(":checked")) {
$(this).closest('tr').addClass("active");
} else {
$(this).closest('tr').removeClass("active");
}
});
});