I have an anchor tag which hides or shows a div but I've been unable to change it's text and icon.
How do I change the text AND icon tag, as currently it parses the icon tag out as regular text.
Anchor tag:
<a class="collapse-info btn"><i class="icon-arrow-up icon-white"></i> Hide Info</a>
I need the class to go from "icon-arrow-up icon-white" to "icon-arrow-down icon-white" and back during toggles.
Javascript (jquery)
$('.collapse-info').toggle(function() {
$('.server-info').slideUp();
$(this).text('Show Info');
}, function () {
$('.server-info').slideDown();
$(this).text('Hide Info');
});
Was trying something like $("#collapse-icon").toggleClass('icon-arrow-down'); but that won't work since the anchor text is overwritten after the initial toggle.
Thanks for any help.