How its work
I had explained Checkall checkbox using jQuery. In this we are going to explain how to do check all check boxs in same fieldset.Simple checks/unchecks all checkboxes with jQuery.
<fieldset> <div><input type="checkbox" class="checkall"> Check all</div> <div><input type="checkbox"> Checkbox</div> <div><input type="checkbox"> Checkbox</div> <div><input type="checkbox"> Checkbox</div> <div><input type="checkbox"> Checkbox</div> <div><input type="checkbox"> Checkbox</div> <div><input type="checkbox"> Checkbox</div> </fieldset>
$(function () { $('.checkall').on('click', function () { $(this).closest('fieldset').find(':checkbox').prop('checked', this.checked); }); });
Demo: