回答編集履歴
1
追記
answer
CHANGED
@@ -5,12 +5,14 @@
|
|
5
5
|
var $this = $(this); // この時点の this はイベントが発生したノードです
|
6
6
|
$(".conent_hide", $this.parent()).slideToggle(function() {
|
7
7
|
if($this.text() == "続きを読む"){
|
8
|
+
$this.text("閉じる").css({color:"green"});
|
9
|
+
} else {
|
8
10
|
$this.text("続きを読む").css({color:"red"});
|
9
|
-
} else {
|
10
|
-
$this.text("閉じる").css({color:"green"});
|
11
11
|
}
|
12
12
|
});
|
13
13
|
});
|
14
14
|
});
|
15
15
|
```
|
16
|
-
イベントが発生した時点の this はその発火したノードになります。ですのでその this を基準に処理を行えばよいです。
|
16
|
+
イベントが発生した時点の this はその発火したノードになります。ですのでその this を基準に処理を行えばよいです。
|
17
|
+
|
18
|
+
あと if が逆ですね。
|