回答編集履歴
1
ちょうせい
test
CHANGED
@@ -12,19 +12,23 @@
|
|
12
12
|
|
13
13
|
<script>
|
14
14
|
|
15
|
-
|
15
|
+
document.addEventListener('click', (e)=>{
|
16
16
|
|
17
|
-
|
17
|
+
const x=e.target;
|
18
18
|
|
19
|
-
|
19
|
+
if(x.classList.contains('cell')){
|
20
20
|
|
21
|
-
|
21
|
+
document.querySelectorAll('.cell').forEach(y=>{
|
22
22
|
|
23
|
+
const flg=x==y;
|
24
|
+
|
25
|
+
//const flg=x==y && !x.classList.contains('active'); //再クリックでactiveを消す
|
26
|
+
|
23
|
-
|
27
|
+
y.classList.toggle('active',flg);
|
24
28
|
|
25
29
|
});
|
26
30
|
|
27
|
-
}
|
31
|
+
}
|
28
32
|
|
29
33
|
});
|
30
34
|
|