Created
April 10, 2015 11:36
-
-
Save iamshanto/0a6a761cb8026989f9dd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<fieldset> | |
<!-- these will be affected by check all --> | |
<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> | |
</fieldset> | |
<fieldset> | |
<!-- these won't be affected by check all; different field set --> | |
<div><input type="checkbox"> Checkbox</div> | |
<div><input type="checkbox"> Checkbox</div> | |
<div><input type="checkbox"> Checkbox</div> | |
</fieldset> | |
<script> | |
$(function () { | |
$('.checkall').on('click', function () { | |
$(this).closest('fieldset').find(':checkbox').prop('checked', this.checked); | |
}); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment