$("#more_see").click(function(){
var $this=$(this);
if($this.text()=='更多' && $this.hasClass("fa fa-chevron-down")){ //找到收起否则不会执行else语句 ==是相等的
$this.text('收起').addClass("fa fa-chevron-up");
alert("收起");
}else{
$this.text('更多').removeClass("fa fa-chevron-down");
alert("更多")
}
});
<span id="more_see" class="show-out fa-chevron-up">更多</span>
$this.hasClass("fa fa-chevron-down")
它的值是true还是false?
可以这样用么?
HTML