You'll be better off using the toggle event that accepts two functions. Then you can do whatever manipulations you want.
Try it out: http://jsfiddle.net/tDr4R/
$(document).ready(function(){
$('#show_review').toggle(
function() {
$(this).text('Hide');
$('#show_something').toggle('slow');
return false;
},
function() {
$(this).text('Show');
$('#show_something').toggle('slow');
return false;
}
);
});
If you don't have any other manipulations needed, another possibility is to pass a function to .text()
.
Try it out: http://jsfiddle.net/tDr4R/1/
$(document).ready(function(){
$('#show_review').click(
function() {
$(this).text(function(i,text) { return (text == 'Show') ? 'Hide' : 'Show'; });
$('#show_something').toggle('slow');
return false;
}
);
});