回答編集履歴

1

tuiki

2019/07/30 10:59

投稿

yambejp
yambejp

スコア114829

test CHANGED
@@ -11,3 +11,47 @@
11
11
  });
12
12
 
13
13
  ```
14
+
15
+ わざわざクラスつけなくてもいい気がします
16
+
17
+
18
+
19
+ ```javascript
20
+
21
+ <script>
22
+
23
+ $(function(){
24
+
25
+ $('label').on('click', function(){
26
+
27
+ $('label').removeClass('selected').has(':checked').addClass('selected');
28
+
29
+ })
30
+
31
+ });
32
+
33
+ </script>
34
+
35
+ <div>
36
+
37
+ <label><input type="radio" name="schoolgrade" value="4" required>小学4年生</label>
38
+
39
+ <label><input type="radio" name="schoolgrade" value="5" required>小学5年生</label>
40
+
41
+ <label><input type="radio" name="schoolgrade" value="6" required>小学6年生</label>
42
+
43
+ </div>
44
+
45
+ <div>
46
+
47
+ <label><input type="radio" name="schoolclass" value="1" required>1組</label>
48
+
49
+ <label><input type="radio" name="schoolclass" value="2" required>2組</label>
50
+
51
+ <label><input type="radio" name="schoolclass" value="3" required>3組</label>
52
+
53
+ <label><input type="radio" name="schoolclass" value="4" required>4組</label>
54
+
55
+ </div>
56
+
57
+ ```