<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 fieldset
<div>
<input type="checkbox"> Checkbox</div>
<div>
<input type="checkbox"> Checkbox</div>
<div>
<input type="checkbox"> Checkbox</div>
</fieldset>
And using function
$(function () { // this line makes sure this code runs on page load
$('.checkall').click(function () {
$(this).parents('fieldset:eq(0)').find(':checkbox').attr('checked', this.checked);
});
});
Checkbox "check all" ever with jQuery
12/20/2010 / by Phuong Nguyen / in JQuery / with No comments /
Related Posts:
Checkbox "check all" ever with jQuery<fieldset> // these will be affected by check all <div> <input type="checkbox" class="checkall"> Check all</div> <div> &… Read More
0 comments:
Đăng nhận xét
Có nhận xét mới