Guest User

Untitled

a guest
Oct 18th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. function scegli(id){
  2.  
  3. var checkedCount=0;
  4. var uncheckCount=0;
  5. var items = $j("." + id);
  6. for(i=0; i<items.length; i++){
  7. if($j(items[i]).attr('checked')=='checked'){
  8. checkedCount++;
  9. }else{
  10. uncheckCount++;
  11. }
  12. }
  13. if(checkedCount==items.length){
  14. $j('#'+ id).prop({
  15. indeterminate: false,
  16. checked: true
  17. });
  18. }else if(uncheckCount==items.length){
  19. $j('#'+ id).prop({
  20. indeterminate: false,
  21. checked: false
  22. });
  23. }else{
  24. $j('#'+ id).prop({
  25. indeterminate: true,
  26. checked: false
  27. });
  28. var parentId = "#" + $j('#'+ id).prop("class");
  29.  
  30. $j(parentId).prop({
  31. indeterminate: true,
  32. checked: false
  33. });
  34. }
  35.  
  36.  
  37. }
  38.  
  39. function initCheckboxes(){
  40. var groups = $j(".chkgroups");
  41. for(var j=0;j<groups.length; j++){
  42. scegli(groups[j].id);
  43. }
  44. scegli("chkgroups");
  45. }
Add Comment
Please, Sign In to add comment