I have a working toggle button that slides a div up and down. The problem I have is when I try changing the toggle button status:
A demo of my code is here: http://jsfiddle.net/zwu0sn83/3/
Button code, with inner span for the icon:
<a href="#" id="toggle-reveal" class="c-1 sort-btn" title="Filter Products"><span class="ico sort"></span> Filter Products</a>
I'm using the following to change text but the span html is actul text rather than html. I need to change text and update the span class:
$(this).text(function(i, text){
return text === "<span class='ico sort'></span>Filter Products" ? "<span class='ico close-sort'></span>Close Filters" : "<span class='ico sort'></span>Filter Products";
});
.html()instead of.text()no? I don't understand what you mean by "but the span html is actul text rather than html. I need to change text and update the span class" - j08691