If you check out the JSFiddle demo and give it a try, you'll notice that while the blue bordered div disappears as intended, the text "Opened" doesn't change to "Closed" when using switchClass() with the :after selector. (Interestingly, switchClass() works fine with other CSS elements)
Here's the 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 disappear :) but the text "Opened" won't change to "Closed"</div>
And the JavaScript:
$(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;
});
});
The CSS is as follows:
.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]";
}
Have any ideas on how to fix this issue?
Could it be that switchClass() and the css :after selector are not playing nicely together?