tCheckAll

A simple way to select all your checkboxes

View the Project on GitHub berumen/tCheckAll

tCheckAll, What is this?

tCheckAll is a jquery plugin that allows you to check or uncheck all your checkboxes.
It was built using the jQuery library.

Author

Copyright (c) 2014 Alfredo Berumen Saldivar
http://berumen.pw
@berumen

How to use

Include tCheckAll plugin in your website directory then load files in the
section of your HTML document. Don't forget to add the jQuery library (version 1.9+).


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

Just put your 'Check All' link, button or any clickable element identified by an id inside a fieldset tag, use whatever name you wish for the id. For example:


<form id="my_id">
<fieldset>
<legend>Select</legend>
<a href="javascript:void(0)" id="all"> Select All</a><br />
<input type="checkbox" name="my_name[]" value="1" />1<br />
<input type="checkbox" name="my_name[]" value="2" />2<br />
<input type="checkbox" name="my_name[]" value="3" />3<br />
<input type="checkbox" name="my_name[]" value="4" />4<br />
<input type="checkbox" name="my_name[]" value="5" />5<br />
</fieldset>
</form>

Trigger the plugin using the following code:


$(document).ready(function() {
  $('#all').tCheckAll();      
});

You can use the following custom events and add your own code


$(document).ready(function() {
  $("#all").on("beforeCheck", function() {
    $(this).text('Un Check All');
  });
  $("#all").on("beforeUnCheck", function() {
    $(this).text('Check All');
  });
});

Example

For a live demonstration visit: tCheckAll demo
Or visit the official web page: Official site

License

Licensed under MIT license

Supported Browsers

Chrome
Safari 6.02+
Firefox 17+
IE 7+
Opera 12.11+

Bug tracker

Have a bug? Please create an issue on GitHub at issues