Search code examples
htmlcheckboxmaterialize

How to use a checkbox in Materialize table


I'm using Materialize and I'm trying to make a table that contains checkboxes. However, there seems to be a problem. A checkbox contained within a table doesn't seem to work. I'm not sure if this a bug or if I'm not doing something correct:

<form action="#">
  <table>
    <thead>
      <tr>
        <th>Name</th>
        <th>Status</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td>My Label</td>
        <td><input type="checkbox" class="filled-in" /><label></label></td>
      </tr>
    </tbody>
  </table>
</form>

How do I make a checkbox contained within a table using Materialize?

http://jsfiddle.net/qa37un79/


Solution

  • You did not have an id for the checkbox and matching for attribute for the label:

    <input type="checkbox" id="myCheckbox" class="filled-in" />
    <label for="myCheckbox"></label>
    

    http://jsfiddle.net/xcmsLee9/1/