Hi
I'm trying to change the text in an anchor on toggle. I'm doing this way at the moment but have found that once the anchor markup has replaced the toggle no longer works. Can someone please explain why this is happening and a solution? Many thanks.
$('a#toggleHeader').toggle(function() {
$('#header-wrapper').slideUp();
$(this).replaceWith('< href=\"#\" id="toggleHeader">Show Header</>');
//Note:I've move the anchor because I can only post one anchor as a new user
},function(){
$('#header-wrapper').slideDown();
$(this).replaceWith('<a href=\"#\" id="toggleHeader">Hide Header</a>');
});