jsfiddleデモを見に行って試してみると、青い境界線のdivが希望どおりに消えていることがわかりますが、switchClass()のテキスト「Opened」は「Closed」に変更されません。(私が他の種類のcss要素を使用し、switchClass()が正常に機能するよりもセレクターの後ではない場合)
HTML:
<div class="filter_title">
<div class="filter_title_price" id="filter_price_toggle"><span>Price</span>
</div>
</div>
<div class="hideprice" style="margin-top:10px; border:1px solid blue;">If you click Price [Opened] I will go away :) but the text "Opened" won't change to text "Closed"</div>
JS:
$(function () {
$("#filter_price_toggle").click(function () {
$(".hideprice").toggle("blind", 250);
$("filter_title_price").switchClass("filter_title_price", "filter_title_price2", 250);
$("filter_title_price2").switchClass("filter_title_price2", "filter_title_price", 250);
return false;
});
});
CSS:
.filter_title {
font-weight:bold;
padding: 3px 10px;
border-style: solid;
border-width: 1px 1px 1px 0;
border-color: #fff #d9d9d9 #d9d9d9;
background-color: #f6f6f6;
margin-top:5px;
}
.filter_title_price:after {
content:"[Opened]";
}
.filter_title_price2:after {
content:"[Closed]";
}
テキストを変更するにはどうすればよいですか?
または、switchClass()とcss:afterセレクターが連携しませんか?