回答編集履歴
1
追記
test
CHANGED
@@ -53,3 +53,53 @@
|
|
53
53
|
});
|
54
54
|
|
55
55
|
```
|
56
|
+
|
57
|
+
#追記
|
58
|
+
|
59
|
+
クリアするバージョンは複雑な条件設定もできますが
|
60
|
+
|
61
|
+
とりあえずauthorityがかわったら全部チェックはずしていいなら以下
|
62
|
+
|
63
|
+
```javascript
|
64
|
+
|
65
|
+
$(function(){
|
66
|
+
|
67
|
+
$('#authority select[name=authority],#shop input[type=checkbox]').on('change',function(e){
|
68
|
+
|
69
|
+
var flg=e.target.name=='authority';
|
70
|
+
|
71
|
+
if(flg) $('#shop input[type=checkbox]').prop('checked',false);
|
72
|
+
|
73
|
+
var v=$('#authority select[name=authority]').val();
|
74
|
+
|
75
|
+
var l=$('#shop input[type=checkbox]:checked').length;
|
76
|
+
|
77
|
+
switch(v){
|
78
|
+
|
79
|
+
case 'user':
|
80
|
+
|
81
|
+
$('#shop input[type=checkbox]:not(:checked)').prop('disabled',l>=1).prop('readonly',false);
|
82
|
+
|
83
|
+
break;
|
84
|
+
|
85
|
+
case 'manager':
|
86
|
+
|
87
|
+
$('#shop input[type=checkbox]:not(:checked)').prop('disabled',false).prop('readonly',false);
|
88
|
+
|
89
|
+
break;
|
90
|
+
|
91
|
+
case 'admin':
|
92
|
+
|
93
|
+
$('#shop input[type=checkbox]:not(:checked)').prop('disabled',false).prop('checked',true).prop('readonly',true);
|
94
|
+
|
95
|
+
break;
|
96
|
+
|
97
|
+
}
|
98
|
+
|
99
|
+
});
|
100
|
+
|
101
|
+
});
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
```
|