jQuery Plugin To Select Deselect All Checkboxes In A Group selectall - Download jQuery Plugin To Select/Deselect All Checkboxes In A Group - selectall

Download jQuery Plugin To Select/Deselect All Checkboxes In A Group – selectall

Posted on

This time I will share jQuery Plugin and tutorial about jQuery Plugin To Select/Deselect All Checkboxes In A Group – selectall, hope it will help you in programming stack.

File Size: 17.3 KB
Views Total: 1190
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   

Just another jQuery ‘Check All’ plugin which enables selection / deselection of all checkboxes in a checkbox group.

How to use it:

1. Download the plugin and then place the main JavaScript file after you’ve loaded the latest version of jQuery library (Slim build is recommended).

1 <script src="//code.jquery.com/jquery-3.1.1.slim.min.js"></script>
2 <script src="jquery.selectall.min.js"></script>

2. Make sure all the checkboxes are wrapped in a same fieldset as follow:

01 <fieldset>
02   <legend>Privacy Communication</legend>
03  
04   <label for="Hushmail">
05     <input id="Hushmail" type="checkbox" value="1">
06     Hushmail
07   </label>
08  
09   <label for="Protonmail">
10     <input id="Protonmail" type="checkbox" value="5">
11     Protonmail (free)
12   </label>
13  
14   <label for="Bitmessage">
15     <input id="Bitmessage" type="checkbox" value="5">
16     Bitmessage (free)
17   </label>
18  
19 </fieldset>

3. Calling the function on the fieldset element will automatically generate ‘select all’ and ‘deselect all’ buttons inside the checkbox group.

1 $("fieldset").selectAll();

4. Customize the ‘select all’ and ‘deselect all’ buttons with the following options.

01 $("fieldset").selectAll({
02   buttonParent: "legend",
03   buttonWrapperHTML: "",
04  
05   buttonSelectText: "Select All",
06   buttonSelectBeforeHTML: "",
07   buttonSelectAfterHTML: "",
08  
09   buttonDeSelectText: "Deselect All1",
10   buttonDeSelectBeforeHTML: "",
11   buttonDeSelectAfterHTML: "",
12  
13   buttonExtraClasses: "btn btn-default"
14 });

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

source : jqueryscript.net