Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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/

like image 345
Luke Avatar asked Jul 10 '15 04:07

Luke


2 Answers

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/

like image 197
Samuel Liew Avatar answered Oct 21 '22 00:10

Samuel Liew


Try this:

<label>
    <input type="checkbox" />
    <span>*** Need text here ***</span>
</label>

Wrapping everything in a label element with a span right under it was the only way I was able to get my checkboxes to display.

like image 29
user9694049 Avatar answered Oct 21 '22 01:10

user9694049