Toggle when a div has been clicked - Javascript jQuery

Javascript examples for jQuery:Mouse Event

Description

Toggle when a div has been clicked

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js">

      </script> 
      <script>
$(document).ready(function(){
  $(".click_me").click(function(){
    $(".hideshow").toggle();
  });/*from   w  w w.  j a  v a 2 s  .c o  m*/
});

      </script> 
   </head> 
   <body> 
      <div class="click_me">
         click me
      </div> 
      <br> 
      <br> 
      <div class="hideshow">
         This is a paragraph.
      </div>  
   </body>
</html>

Related Tutorials