samedi 4 juillet 2020

Disable/Hide checkboxes in a checkbox list given the value of a checkbox (pure JS)

I'm trying to disable or hide some checkboxes in a list of checkboxes given a max number of checkboxes allowed to be selected. i.e. If the value of checkbox is greater that my_value then the checkbox is disabled/hidden and cannot be selected... and work it into this code:

<div class="container">
  <table class="table">
    <thead>
      <tr>
        <th align="left">Max Number of Checks</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td>
          <input id="Check_01" name="FW_check" value="1" type="checkbox" />
          <input id="Check_02" name="FW_check" value="2" type="checkbox" />
          <input id="Check_03" name="FW_check" value="3" type="checkbox" />
          <input id="Check_04" name="FW_check" value="4" type="checkbox" />
          <input id="Check_05" name="FW_check" value="5" type="checkbox" />
        </td>
      </tr>
      <tr>
        <td>
          <input id="Check_06" name="FW_check" value="6" type="checkbox" />
          <input id="Check_07" name="FW_check" value="7" type="checkbox" />
          <input id="Check_08" name="FW_check" value="8" type="checkbox" />
          <input id="Check_09" name="FW_check" value="9" type="checkbox" />
          <input id="Check_10" name="FW_check" value="10" type="checkbox" />
        </td>
      </tr>
    </tbody>
  </table>
</div>



Aucun commentaire:

Enregistrer un commentaire