I have problem dealing with unchecking all checkboxes. When I click on a toggle all checkbox, it could check all checkboxes. But if I uncheck the toggle all checkbox, nothin
The problem boils down to how you're setting the checked
property of the checkox. You're assigning a string with "true" where you should be assigning the boolean value true
.
So to fix your code is easy:
if( isAllCheck == false ){
cbarray[i].checked = true;
}else{
cbarray[i].checked = false;
}
or, more succinctly
cbarray[i].checked = !isAllCheck
Live example: http://jsfiddle.net/SEJZP/