JavaScript Toggel Hide and Show

 

The toggle() method toggles between hide() and show() for the selected elements.
This method checks the selected elements for visibility.
show() is run if an element is hidden.
hide() is run if an element is visible - This creates a toggle effect.
To do this, first download this Library Function jquery-2.2.0.min.js file.
Then copy and run the Example code given below.

Example of this code:

<!DOCTYPE html>
<html> 
<body> 
<h1>toggle()</h1>
<input type="button" id="btn" value="Show/Hide"
<div id="d1">Web design a to z.You can learn web design with us also learn Html,Css,php,javascript,j query</div>
<script src="jquery-2.2.0.min.js"></script>
<script>
  $(document).ready(function()
  {
   $("#btn").click(function()
   {
    $("#d1").toggle();
   });
  });
</script> 
</body> 
</html>


Post a Comment

0 Comments
* Please Don't Spam Here. All the Comments are Reviewed by Admin.