Gyancode

A free library of HTML, CSS, JS

Search This Blog

Friday 5 August 2016

Less & show button in jquery with toggle

<script type="text/javascript">
jQuery(document).ready(function(){
    jQuery('#hideshow').live('click', function(event) {       
         jQuery('#content').toggle('show');
         var text = jQuery("#hideshow").html();      
         if (String(text) == "Less") {
            jQuery("#hideshow").html("More");
         } else {
            jQuery("#hideshow").html("Less");
         }
    });
});
</script>
<a id='hideshow' class="more">More</a>
<div id='content' style='display:none;'>
Akshay check text
</div>

No comments :

Post a Comment