/ Published in: JavaScript

How does it work?
This code checks/unchecks all checkboxes within the same fieldset. Simple and semantic.
HTML Setup
Add checkboxes however you like, just make sure they are within the same fieldset.
Check all
Checkbox
Checkbox
Checkbox
Checkbox
Checkbox
Checkbox
This code checks/unchecks all checkboxes within the same fieldset. Simple and semantic.
HTML Setup
Add checkboxes however you like, just make sure they are within the same fieldset.
Check all
Checkbox
Checkbox
Checkbox
Checkbox
Checkbox
Checkbox
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
$(function () { $('.checkall').click(function () { $(this).parents('fieldset:eq(0)').find(':checkbox').attr('checked', this.checked); }); });
URL: http://briancray.com/posts/check-all-jquery-javascript
Comments
