$(function () { $('.checkall').on('click', function () { $(this).closest('fieldset').find(':checkbox').prop('checked', this.checked); }); });
<!-- if not work then select leftside jQuery lib--> <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>