回答編集履歴
4
追記
test
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
|
7
7
|
|
8
8
|
|
9
|
-
# 追記
|
9
|
+
# 追記1
|
10
10
|
|
11
11
|
とりあえず上記条件で
|
12
12
|
|
@@ -46,8 +46,6 @@
|
|
46
46
|
|
47
47
|
```PHP
|
48
48
|
|
49
|
-
<?php
|
50
|
-
|
51
49
|
$data=[
|
52
50
|
|
53
51
|
array("id_mbr"=>"a0","email_1_mbr"=>"a1","email_2_mbr"=>"a2"),
|
@@ -77,3 +75,41 @@
|
|
77
75
|
|
78
76
|
|
79
77
|
```
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
# 追記2
|
82
|
+
|
83
|
+
ご希望と思われる仕様バージョン
|
84
|
+
|
85
|
+
```javascript
|
86
|
+
|
87
|
+
$(function(){
|
88
|
+
|
89
|
+
$('.checkAll').click(function() {
|
90
|
+
|
91
|
+
$('.' + this.id).prop('checked', this.checked);
|
92
|
+
|
93
|
+
});
|
94
|
+
|
95
|
+
$('input[type=checkbox]').click(function() {
|
96
|
+
|
97
|
+
if($('#' + $(this).prop('className'))[0]){
|
98
|
+
|
99
|
+
var flg=false;
|
100
|
+
|
101
|
+
$('.' + $(this).prop('className')).each(function(){
|
102
|
+
|
103
|
+
if($(this).prop('checked')){ flg=true};
|
104
|
+
|
105
|
+
});
|
106
|
+
|
107
|
+
$('#' + $(this).prop('className')).prop("checked",flg);
|
108
|
+
|
109
|
+
}
|
110
|
+
|
111
|
+
});
|
112
|
+
|
113
|
+
});
|
114
|
+
|
115
|
+
```
|
3
修正
test
CHANGED
@@ -26,19 +26,11 @@
|
|
26
26
|
|
27
27
|
var flg=true;
|
28
28
|
|
29
|
-
|
29
|
+
$('.' + $(this).prop('className')).each(function(){
|
30
30
|
|
31
|
-
flg=false;
|
31
|
+
if(!$(this).prop('checked')){ flg=false};
|
32
32
|
|
33
|
-
}else{
|
34
|
-
|
35
|
-
$('.' + $(this).prop('className')).each(function(){
|
36
|
-
|
37
|
-
if(!$(this).prop('checked')){ flg=false};
|
38
|
-
|
39
|
-
|
33
|
+
});
|
40
|
-
|
41
|
-
}
|
42
34
|
|
43
35
|
$('#' + $(this).prop('className')).prop("checked",flg);
|
44
36
|
|
2
ゴミ
test
CHANGED
@@ -35,8 +35,6 @@
|
|
35
35
|
$('.' + $(this).prop('className')).each(function(){
|
36
36
|
|
37
37
|
if(!$(this).prop('checked')){ flg=false};
|
38
|
-
|
39
|
-
console.log(flg);
|
40
38
|
|
41
39
|
});
|
42
40
|
|
1
変更1
test
CHANGED
@@ -3,3 +3,87 @@
|
|
3
3
|
逆にcheckAllがチェックされてる場合メール1とメール2のいずれかのチェックが外れたら、checkAllのチェックもはずしたい
|
4
4
|
|
5
5
|
という意味でしょうか?
|
6
|
+
|
7
|
+
|
8
|
+
|
9
|
+
# 追記
|
10
|
+
|
11
|
+
とりあえず上記条件で
|
12
|
+
|
13
|
+
```javascript
|
14
|
+
|
15
|
+
$(function(){
|
16
|
+
|
17
|
+
$('.checkAll').click(function() {
|
18
|
+
|
19
|
+
$('.' + this.id).prop('checked', this.checked);
|
20
|
+
|
21
|
+
});
|
22
|
+
|
23
|
+
$('input[type=checkbox]').click(function() {
|
24
|
+
|
25
|
+
if($('#' + $(this).prop('className'))[0]){
|
26
|
+
|
27
|
+
var flg=true;
|
28
|
+
|
29
|
+
if(!this.checked){
|
30
|
+
|
31
|
+
flg=false;
|
32
|
+
|
33
|
+
}else{
|
34
|
+
|
35
|
+
$('.' + $(this).prop('className')).each(function(){
|
36
|
+
|
37
|
+
if(!$(this).prop('checked')){ flg=false};
|
38
|
+
|
39
|
+
console.log(flg);
|
40
|
+
|
41
|
+
});
|
42
|
+
|
43
|
+
}
|
44
|
+
|
45
|
+
$('#' + $(this).prop('className')).prop("checked",flg);
|
46
|
+
|
47
|
+
}
|
48
|
+
|
49
|
+
});
|
50
|
+
|
51
|
+
});
|
52
|
+
|
53
|
+
|
54
|
+
|
55
|
+
```
|
56
|
+
|
57
|
+
```PHP
|
58
|
+
|
59
|
+
<?php
|
60
|
+
|
61
|
+
$data=[
|
62
|
+
|
63
|
+
array("id_mbr"=>"a0","email_1_mbr"=>"a1","email_2_mbr"=>"a2"),
|
64
|
+
|
65
|
+
array("id_mbr"=>"b0","email_1_mbr"=>"b1","email_2_mbr"=>"b2"),
|
66
|
+
|
67
|
+
array("id_mbr"=>"c0","email_1_mbr"=>"c1","email_2_mbr"=>"c2"),
|
68
|
+
|
69
|
+
];
|
70
|
+
|
71
|
+
foreach ($data as $key => $value) {
|
72
|
+
|
73
|
+
print <<<eof
|
74
|
+
|
75
|
+
<input type="checkbox" id="delete_{$value['id_mbr']}" class="checkAll" name="select_delete[]" value="{$value['id_mbr']}" >名前<br>
|
76
|
+
|
77
|
+
<input type="checkbox" value="{$value["email_1_mbr"]}" class="delete_{$value['id_mbr']}"> メールアドレス1<br>
|
78
|
+
|
79
|
+
<input type="checkbox" value="{$value["email_2_mbr"]}" class="delete_{$value['id_mbr']}">メールアドレス2<br>
|
80
|
+
|
81
|
+
|
82
|
+
|
83
|
+
eof;
|
84
|
+
|
85
|
+
}
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
```
|