I try to use this code for toggling text on the link:
var showText="<span>Open</span> ↓";
var hideText="<span>Close</span> ↑";
$('h1').before('<a href="javascript:;" id="hc_toggle_close">' + showText + '</a>');
$('#hc_toggle_close').click(function () {
$('#hc_toggle_close:contains("Open")').html(hideText);
$('#hc_toggle_close:contains("Close")').html(showText);
});
But it does not work! As well as an usual if ... else construction. Could someone please point me what's wrong here. Thanks!