Hi,
i've implemented a simple div toggle and I'd like to change the text to display Hide after its clicked... Is there a var text line I could add?
Code:$(document).ready(function () { $('.show').click(function () { $(this).siblings('.hide:first').slideToggle('fast') }); });Code:<div class="show"><span style="cursor:pointer">Read more...</span></div> <!--1st toggle div--> <div class="hide" style="display:none;"> CONTENT </div><!--/hide-->
I was thinking somthing lean like;
Code:$(document).ready(function () { $('.show').click(function () { $(this).siblings('.hide:first').slideToggle('fast') }); var text = $('.hide').text(); $('.hide').text( text == "Hide" ? "Read more" : "Hide"); });



Reply With Quote


Bookmarks