回答編集履歴

4

ラジオボタンの処理がバグっているため修正

2020/08/24 02:04

投稿

root_jp
root_jp

スコア4666

test CHANGED
@@ -2,11 +2,15 @@
2
2
 
3
3
  $(function () {
4
4
 
5
- // ラジオボタンがクリックされたら
5
+ // // ラジオボタンがクリックされたら
6
6
 
7
7
  $("input[name='cr2']").on("click", function() {
8
8
 
9
+ $("input[name='cr2']").each(function() {
10
+
9
- $(this).closest(".c-table__tr").toggleClass("active");
11
+ $(this).closest(".c-table__tr").toggleClass("active", this.checked);
12
+
13
+ })
10
14
 
11
15
  });
12
16
 

3

元ソースに似たようなコメントも追記

2020/08/24 02:04

投稿

root_jp
root_jp

スコア4666

test CHANGED
@@ -1,6 +1,8 @@
1
1
  ```JavaScript
2
2
 
3
3
  $(function () {
4
+
5
+ // ラジオボタンがクリックされたら、
4
6
 
5
7
  $("input[name='cr2']").on("click", function() {
6
8
 

2

ラジオボタンの処理が抜けていたので追記

2020/08/24 01:56

投稿

root_jp
root_jp

スコア4666

test CHANGED
File without changes

1

ラジオボタンの処理が抜けていたので追記

2020/08/24 01:55

投稿

root_jp
root_jp

スコア4666

test CHANGED
@@ -1,6 +1,14 @@
1
1
  ```JavaScript
2
2
 
3
3
  $(function () {
4
+
5
+ $("input[name='cr2']").on("click", function() {
6
+
7
+ $(this).closest(".c-table__tr").toggleClass("active");
8
+
9
+ });
10
+
11
+
4
12
 
5
13
  // 「全選択」する
6
14
 
@@ -28,6 +36,4 @@
28
36
 
29
37
  });
30
38
 
31
-
32
-
33
39
  ```