Skip to content
Check or uncheck all checkboxes bei one checkbox referenced by data-reference.
JavaScript
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
css
dist
src
.gitignore
README.md
grunt.js
index.html
package.json

README.md

checkboxToggleizr

Check or uncheck all checkboxes by one element referenced by a data-reference attribute.

How to Use?

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8/jquery.min.js"></script>
<script src="dist/jquery.checkboxToggleizr.min.js"></script>
<script>
	$('#select-all').checkboxToggleizr({ invert: false });
</script>
<table>
  <thead>
    <tr>
      <th colspan="2">Name</th>
      <th>Age</th>
    </tr>
  </thead>
  <tfoot>
    <tr>
      <td colspan="3">
        <label><input type="checkbox" id="select-all" data-reference="items[]" /> Select all</label>
      </td>
    </tr>
  </tfoot>
  <tbody>
    <tr>
      <td><input type="checkbox" name="items[]" value="1" /></td>
      <td>Ben</td>
      <td>22</td>
    </tr>
    <tr>
      <td><input type="checkbox" name="items[]" value="2" /></td>
      <td>Marc</td>
      <td>48</td>
    </tr>
    <tr>
      <td><input type="checkbox" name="items[]" value="3" /></td>
      <td>Tom</td>
      <td>20</td>
    </tr>
    <tr>
      <td><input type="checkbox" name="items[]" value="4" /></td>
      <td>Bennet</td>
      <td>25</td>
    </tr>
    <tr>
      <td><input type="checkbox" name="items[]" value="5" /></td>
      <td>Max</td>
      <td>37</td>
    </tr>
  </tbody>
</table>

Options

Option Arguments Description
invert true/false
default: false
If false, all checkboxes will be checkt/unchecked.
If true all checkboxes will be inverted. (Checked become unchecked and unchecked become checked.
You can’t perform that action at this time.