Simple Form Check All Plugin For jQuery

File Size: 23 KB
Views Total: 1522
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   
Simple Form Check All Plugin For jQuery

Check All is a lightweight and user-friendly jQuery plugin that allows your user to check all or uncheck all the options with one click.

You might also like:

How to use it:

1. Include jQuery library and jquery-check-all.min.js on your webpage

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="jquery-check-all.min.js"></script>

2. Markup

<form>
<input id="demo" type="checkbox"> Check All
<input type="checkbox" value="1"> option 1
<input type="checkbox" value="2"> option 2
<input type="checkbox" value="3"> option 3
</form>

3. Call the plugin

$(document).ready(function() {
  $('#demo').checkAll();
});

4. Default options available.

// A selector string or jQuery object of the element which contains the children 
container: document,

// A selector string or jQuery object of the children checkboxes. 
childCheckboxes: 'input[type=checkbox]',

// Whether to display the check all checkbox in the indeterminate state if a subset of the children checkboxes are selected.
showIndeterminate: false

Change logs:

2015-07-16

  • Allow options to be set via HTML data attributes.

2014-10-12

  • fixes parent checkbox is checked when no children

This awesome jQuery plugin is developed by markgx. For more Advanced Usages, please check the demo page or visit the official website.