mercredi 22 juillet 2015

Event binding between checkbox and dropdown menu

Here is my table:

<table>                    
  <tr>
    <td>
      <label for="check">
        <input type="checkbox" name="check" id="check" value="true" />
        Select something
      </label>
    </td>

    <td>
      <label for="select">
        <select name="select" id="select">
        <option value="Default"></option>
        <option value="A">A</option>
        <option value="B">B</option>
      </label>
    <td>
  </tr>

I am trying to link the checkbox functionality with the dropdown menu as such: if the checkbox is unchecked, and the user selects an option whose option value is not "Default", then the checkbox should get checked automatically and highlighted with a 'selected' class. And then anytime the "Default" value is selected, the checkbox should be unchecked and unhighlighted regardless of its previous state.




Aucun commentaire:

Enregistrer un commentaire