Reputation: 47
I feel as though this fairly simple and probably a common problem, but i need to change the text back to it original state on a second click,
$('#about').hide();
$('#about-btn').click(function(){
$('#about').toggle('down'),
$(this).text('close');
});
It stays with the words closed and I need it to switch about when the element is toggled.
Upvotes: 1
Views: 66
Reputation: 145438
$("#about-btn").click(function() {
if (this.innerHTML === "close") {
this.innerHTML = "open";
$("#about").slideUp();
} else {
this.innerHTML = "close";
$("#about").slideDown();
}
});
DEMO: http://jsfiddle.net/pX4QW/
Upvotes: 2