JSFiddle - React, Tailwind, and code Playground
HTML
<table>
<tr>
<td>
<input type='checkbox' value='0' class=''>
</td>
<td>
<input type='checkbox' value='0' class=''>
</td>
<td>
<input type='checkbox' value='0' class=''>
</td>
<td width="100" align="right">
select all <input type='checkbox' value='0' class='selectall2'>
</td>
</tr>
</table>
JavaScript
$(document).ready(function () {
$(document).on("click", ".selectall2", function () {
$(this).closest('tr').find('input[type=checkbox]').attr('checked', this.checked);
});
});