I am trying to have a checkbox that checks/unchecks all the other checkboxes.
I am using this code:
$(\"#checkall\").toggle(
function () {
edit: while I writed, xeno06 answered too :)
when you click "checkall", it 1) set the value to checked, and then 2) call the toggle function, which will find "checkall", and toogle it back.
best way is to not put the ".kselItems" class to "checkAll" or, if "checkall" is inside ".ksleItems" use
$(".kselItems not(#checkall)").(...)
or
$(".kselItems").not("#checkall").(...)
for clarity I would use naveen solution
$("#checkall").click(function() {
$(".kselItems :checkbox").not("#checkall").attr('checked', this.checked);
});