JSFiddle - React, Tailwind, and code Playground

by alexbfree

HTML

<input name="Check100" id="Check100" type="checkbox">
<table id="myTable">
    <tr>
        <td><input name="ClassIDs" type="checkbox" value="3132"></td>
        <td>50</td>
    </tr>
    <tr>
        <td><input name="ClassIDs" type="checkbox" value="3133"></td>
        <td>1000</td>
    </tr>
    <tr>
        <td><input name="ClassIDs" type="checkbox" value="3133"></td>
        <td>100</td>
    </tr>
</table>

JavaScript

$(function(){
    $('#Check100').change(function() {
        var $checkbox = $('#myTable td')
            .filter(function() {
                return $(this).text() == "100";
            }).prev('td').find(':checkbox');
    
        if(this.checked)
            $checkbox.attr('checked', 'checked');
        else
            $checkbox.removeAttr('checked');
    });
});