dimanche 6 mars 2022

Check / Uncheck corresponding checkboxes in different columns

I have 2 columns 'Select' & 'Super' these columns have checkboxes, and can be selected or unselected by the user. What I am looking for is a jQuery solution to :

  1. If any checkbox in Column B (super) is selected then the corresponding checkbox in Column A (select) should be checked
  2. If any checkbox in Column A (select) is unselected, then the corresponding checkbox in Column B (super) should be unchecked

The HTML code that I have is:

<td>
    <input type="checkbox" id="select1" checked="checked" class="select-checkbox">
</td>
<td><input type="checkbox" id="super1" class="super-checkbox">
</td>
</tr>
<tr>
    <td><input type="checkbox" id="select2" class="select-checkbox">
    </td>
    <td><input type="checkbox" id="super2" class="hrpda-interview-super-checkbox">
    </td>
</tr>
<tr>
    <td><input type="checkbox" id="select3" checked="checked" class="hrpda-interview-select-checkbox">
    </td>
    <td><input type="checkbox" id="super3" checked="checked" class="super-checkbox">
    </td>
</tr>
<tr>
    <td><input type="checkbox" id="select4" checked="checked" class="select-checkbox">
    </td>
    <td><input type="checkbox" id="super4" checked="checked" class="super-checkbox">
    </td>
</tr>```



Aucun commentaire:

Enregistrer un commentaire