Wednesday, May 23, 2012

slideToggle: Change the text a second time (open -> close -> open -> close...)

<div id="sidebar_archive_infoline_bottom"><a id="showallnews" href="#">SHOW ALL NEWS</a></div>     

<script>
$('#newsdiv').hide();
$('#showallnews').click(function () {
$('#newsdiv').slideToggle('fast');
$('#showallnews').text('CLOSE')
}); </script>


The text "SHOW ALL NEWS" changes to "CLOSE" after clicking the first time on it. Now I need a method to change it from "CLOSE" to "SHOW ALL NEWS" and so on...



Best regards!





No comments:

Post a Comment