回答編集履歴
1
tuiki
answer
CHANGED
@@ -4,4 +4,26 @@
|
|
4
4
|
$('.schoolgrade,.schoolclass').removeClass('selected').has(':checked').addClass('selected');
|
5
5
|
})
|
6
6
|
});
|
7
|
+
```
|
8
|
+
わざわざクラスつけなくてもいい気がします
|
9
|
+
|
10
|
+
```javascript
|
11
|
+
<script>
|
12
|
+
$(function(){
|
13
|
+
$('label').on('click', function(){
|
14
|
+
$('label').removeClass('selected').has(':checked').addClass('selected');
|
15
|
+
})
|
16
|
+
});
|
17
|
+
</script>
|
18
|
+
<div>
|
19
|
+
<label><input type="radio" name="schoolgrade" value="4" required>小学4年生</label>
|
20
|
+
<label><input type="radio" name="schoolgrade" value="5" required>小学5年生</label>
|
21
|
+
<label><input type="radio" name="schoolgrade" value="6" required>小学6年生</label>
|
22
|
+
</div>
|
23
|
+
<div>
|
24
|
+
<label><input type="radio" name="schoolclass" value="1" required>1組</label>
|
25
|
+
<label><input type="radio" name="schoolclass" value="2" required>2組</label>
|
26
|
+
<label><input type="radio" name="schoolclass" value="3" required>3組</label>
|
27
|
+
<label><input type="radio" name="schoolclass" value="4" required>4組</label>
|
28
|
+
</div>
|
7
29
|
```
|