Attaches select all and select none behavior to a checkbox for a group of checkboxes provided. If those checkboxes change state to which all checkboxes are selected, the "select all" checkbox is selected. If any of the checkboxes are deselected the "select all" checkbox is deselected.
select-all depends on jquery. It is preferred to use 1.9 or above to make use of the prop method. There is handling within this to use attr if prop is unavailable.
For the markup:
<html>
<head></head>
<body>
<div>
<input type='checkbox' class='select-all' />
<div id='container'>
<input type='checkbox' class='select-all'>a</input>
<input type='checkbox' class='select-all'>b</input>
<input type='checkbox' class='select-all'>c</input>
<input type='checkbox' class='select-all'>d</input>
</div>
</div>
</body>
</html>
Use:
$('.select-all').selectall('#container');
or
$('.select-all').selectall('#container input:checkbox');
or
$('.select-all').selectall($('#container input:checkbox'));
