cux-test
Version:
[SB Admin](http://startbootstrap.com/template-overviews/sb-admin/) is an open source, admin dashboard template for [Bootstrap](http://getbootstrap.com/) created by [Start Bootstrap](http://startbootstrap.com/).
17 lines (14 loc) • 594 B
JavaScript
var checkboxes = document.querySelectorAll('input.thing'),
checkall = document.getElementById('checkall');
for (var i = 0; i < checkboxes.length; i++) {
checkboxes[i].onclick = function () {
var checkedCount = document.querySelectorAll('input.thing:checked').length;
checkall.checked = checkedCount > 0;
checkall.indeterminate = checkedCount > 0 && checkedCount < checkboxes.length;
}
}
checkall.onclick = function () {
for (var i = 0; i < checkboxes.length; i++) {
checkboxes[i].checked = this.checked;
}
}