質問するログイン新規登録

回答編集履歴

1

記述ミス

2019/11/20 01:44

投稿

nt4c
nt4c

スコア768

answer CHANGED
@@ -11,7 +11,7 @@
11
11
  const $target = document.querySelector('.js-target')
12
12
 
13
13
  $target.addEventListener('click', () => {
14
- if ($target.classList.contains("test")) {
14
+ if ($target.classList.contains("is-active")) {
15
15
  $target.classList.remove("is-active")
16
16
  } else {
17
17
  $target.classList.add("is-active")