jQuery Plugin To (un)Select All The Checkboxes By One Click - tCheckAll

jQuery Plugin To (un)Select All The Checkboxes By One Click - tCheckAll
File Size: 6.66 KB
Views Total:
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   

tCheckAll is a dead simple jQuery plugin which allows you select and un-select all the checkboxes by one click.

See also:

How to use it:

1. Load the jQuery tCheckAll script after jQuery javascript library.

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js" type="text/javascript"></script>
<script src="jquery.tcheckall.min.js" type="text/javascript"></script>

2. Create a 'select all' link (or button) for a list of checkboxes.

<form id="demo">
  <fieldset>
    <a href="javascript:void(0)" id="all"> Select All</a>
    <input type="checkbox" name="number[]" value="1" />
    Value 1
    <input type="checkbox" name="number[]" value="1" />
    Value 2
    <input type="checkbox" name="number[]" value="1" />
    Value 3
    ...
  </fieldset>
</form>

3. Call the plugin on the 'select all' link.

<script type="text/javascript">
$(function() {

$('#demo').tCheckAll();

$("#demo").on("beforeCheck", function() {
$(this).text('Un Select All');
});
$("#demo").on("beforeUnCheck", function() {
$(this).text('Select All');
});

});

</script>

About Author:

Author: @berumen

Website: http://berumen.pw 


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