jQuery toggle


jQuery toggle is used to provide the toggle functionality between the hide() and show() method.
It hides the shown elements and shows the hidden elements.


Syntax : jQuery toggle

$(selector).toggle(speed,selector);

jQuery toggle Example 1 :

Example


<script type="text/javascript">
         $(document).ready(function(){
          $("#togglebutton").click(function(){
           $(".demo-para").toggle();   
          });        
          });
</script>    

Try it »

jQuery toggle Example 2 :

Example With Speed


<script type="text/javascript">
         $(document).ready(function(){
          $("#togglebutton").click(function(){
           $(".demo-para").toggle(500);   
          });        
          });
</script>    

Try it »

jQuery toggle

jQuery toggle


Advertisements

Add Comment

📖 Read More