回答編集履歴
1
コード修正
test
CHANGED
@@ -14,16 +14,36 @@
|
|
14
14
|
|
15
15
|
if(gender=='male'){
|
16
16
|
|
17
|
-
console.log(gender);
|
18
|
-
|
19
17
|
check.style.color = 'Blue';
|
20
18
|
|
21
19
|
}else if (gender=='female'){
|
22
|
-
|
23
|
-
console.log(gender);
|
24
20
|
|
25
21
|
check.firstElementChild.style.color = 'Red';
|
26
22
|
|
27
23
|
}
|
28
24
|
|
29
25
|
```
|
26
|
+
|
27
|
+
|
28
|
+
|
29
|
+
あるいは、
|
30
|
+
|
31
|
+
|
32
|
+
|
33
|
+
```js
|
34
|
+
|
35
|
+
var gender = document.getElementById('gender').textContent;
|
36
|
+
|
37
|
+
var check = document.querySelector('#check > a');
|
38
|
+
|
39
|
+
if(gender=='male'){
|
40
|
+
|
41
|
+
check.style.color = 'Blue';
|
42
|
+
|
43
|
+
}else if (gender=='female'){
|
44
|
+
|
45
|
+
check.style.color = 'Red';
|
46
|
+
|
47
|
+
}
|
48
|
+
|
49
|
+
```
|