回答編集履歴
2
別にpropをつかわなくてもよかった箇所を修正
test
CHANGED
@@ -20,7 +20,7 @@
|
|
20
20
|
|
21
21
|
if (name) { selector += "[name='" + name + "']"; }
|
22
22
|
|
23
|
-
$(selector).each(function(){
|
23
|
+
$(selector).each(function(){ this.preChecked = this.checked; });
|
24
24
|
|
25
25
|
}
|
26
26
|
|
@@ -32,9 +32,9 @@
|
|
32
32
|
|
33
33
|
$("input:radio").on("click", function() {
|
34
34
|
|
35
|
-
if (
|
35
|
+
if (this.preChecked == true) {
|
36
36
|
|
37
|
-
|
37
|
+
this.checked = false;
|
38
38
|
|
39
39
|
}
|
40
40
|
|
1
重くなるという懸念に対応
test
CHANGED
@@ -14,9 +14,13 @@
|
|
14
14
|
|
15
15
|
|
16
16
|
|
17
|
-
function savePreChecked() {
|
17
|
+
function savePreChecked(name) {
|
18
18
|
|
19
|
+
var selector = "input:radio";
|
20
|
+
|
21
|
+
if (name) { selector += "[name='" + name + "']"; }
|
22
|
+
|
19
|
-
$(
|
23
|
+
$(selector).each(function(){ $(this).prop("preChecked", $(this).prop("checked")); });
|
20
24
|
|
21
25
|
}
|
22
26
|
|
@@ -34,7 +38,7 @@
|
|
34
38
|
|
35
39
|
}
|
36
40
|
|
37
|
-
savePreChecked();
|
41
|
+
savePreChecked(this.name);
|
38
42
|
|
39
43
|
});
|
40
44
|
|