Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function scegli(id){
- var checkedCount=0;
- var uncheckCount=0;
- var items = $j("." + id);
- for(i=0; i<items.length; i++){
- if($j(items[i]).attr('checked')=='checked'){
- checkedCount++;
- }else{
- uncheckCount++;
- }
- }
- if(checkedCount==items.length){
- $j('#'+ id).prop({
- indeterminate: false,
- checked: true
- });
- }else if(uncheckCount==items.length){
- $j('#'+ id).prop({
- indeterminate: false,
- checked: false
- });
- }else{
- $j('#'+ id).prop({
- indeterminate: true,
- checked: false
- });
- var parentId = "#" + $j('#'+ id).prop("class");
- $j(parentId).prop({
- indeterminate: true,
- checked: false
- });
- }
- }
- function initCheckboxes(){
- var groups = $j(".chkgroups");
- for(var j=0;j<groups.length; j++){
- scegli(groups[j].id);
- }
- scegli("chkgroups");
- }
Add Comment
Please, Sign In to add comment