When using slideToggle, how to change the Text close/show? I did a simple one, but cannot get the text change back.
slideToggle
Here is what I did:
Just add a simple if statement to test the text like so
$('.open').click(function(){ $('.showpanel').slideToggle('slow'); if($(this).text() == 'close'){ $(this).text('Show'); } else { $(this).text('close'); } });
Like this DEMO