質問編集履歴

4

2018/07/06 15:24

投稿

Gecko
Gecko

スコア24

test CHANGED
File without changes
test CHANGED
@@ -42,7 +42,7 @@
42
42
 
43
43
  function like (num) {
44
44
 
45
- if (document.getElementByID("button-post-like-"+num).classList("like")) {
45
+ if (document.getElementByID("button-post-like-"+num).classList.contains("like")) {
46
46
 
47
47
  document.getElementById("button-post-like-"+num).classList.remove("ion-ios-heart", "like");
48
48
 

3

不足部分の追記

2018/07/06 15:24

投稿

Gecko
Gecko

スコア24

test CHANGED
File without changes
test CHANGED
@@ -12,13 +12,13 @@
12
12
 
13
13
  **like(1)実行前**
14
14
 
15
- <ons-icon id="~" icon="~" class="ons-icon ons-icon--ion ion-ios-heart-outline">
15
+ <ons-icon id="button-post-like-1" icon="ion-ios-heart-outline" class="ons-icon ons-icon--ion ion-ios-heart-outline">
16
16
 
17
17
  **like(1)実行後**
18
18
 
19
- <ons-icon id="~" icon="~" class="ons-icon ons-icon--ion ion-ios-heart like">
19
+ <ons-icon id="button-post-like-1" icon="ion-ios-heart-outline" class="ons-icon ons-icon--ion ion-ios-heart like">
20
20
 
21
- のように変化するのはわかり
21
+ のように変化していした
22
22
 
23
23
 
24
24
 
@@ -54,7 +54,7 @@
54
54
 
55
55
  document.getElementById("button-post-like-"+num).classList.add("ion-ios-heart","like");
56
56
 
57
- };
57
+ };
58
58
 
59
59
  };
60
60
 

2

2018/07/06 09:49

投稿

Gecko
Gecko

スコア24

test CHANGED
File without changes
test CHANGED
@@ -56,6 +56,8 @@
56
56
 
57
57
  };
58
58
 
59
+ };
60
+
59
61
  ```
60
62
 
61
63
  ```HTML

1

2018/07/06 09:33

投稿

Gecko
Gecko

スコア24

test CHANGED
File without changes
test CHANGED
@@ -44,7 +44,7 @@
44
44
 
45
45
  if (document.getElementByID("button-post-like-"+num).classList("like")) {
46
46
 
47
- document.getElementById("button-post-like-"+num).classList.remove("ion-ios-heart", "like);
47
+ document.getElementById("button-post-like-"+num).classList.remove("ion-ios-heart", "like");
48
48
 
49
49
  document.getElementById("button-post-like-"+num).classList.add("ion-ios-heart-outline");
50
50