This file contains hidden or 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
<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script> | |
<script><br /> | |
$(function () {<br /> | |
$('.checkall').on('click', function () {<br /> | |
$(this).closest('fieldset').find(':checkbox').prop('checked', this.checked);<br /> | |
});<br /> | |
});<br /> | |
</script> | |
Select/Unselect Check Boxes using Jquery | |
DEMO: | |
<fieldset>These will be affected by check all | |
<div><input class="checkall" type="checkbox"> 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 src="http://code.jquery.com/jquery-1.11.0.min.js"></script> | |
<script> | |
$(function () { | |
$('.checkall').on('click', function () { | |
$(this).closest('fieldset').find(':checkbox').prop('checked', this.checked); | |
}); | |
}); | |
</script> | |
Written By Brian Cray |