Friday, 9 August 2013

jQuery change text on toggle

jQuery change text on toggle

Below I'm trying to use jQuery to open and close a pane, but I'd also like
to use jQuery to toggle the text too. Could someone assist in helping me
rename .chatstatus to either open or close when its toggled?
$('.chatstatus').click(function(){
$('.mChatBodyFix').slideToggle(500);
$.cookie('chatPane', $.cookie('chatPane')=='open'?"closed":"open",
{expires:1});
var chatstatustext = $('.chatstatus').text();
$('.chatstatus').html() == chatstatustext?"close":"open";
});

No comments:

Post a Comment