Advertisement
saasbook

Simple jQuery example

Oct 27th, 2013
1,038
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
jQuery 0.68 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3.   <head>
  4.     <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
  5.     <script language="javascript" type="text/javascript">
  6. var hideTest = {
  7.   hidePara: function() {
  8.     if ( $(this).is(':checked') ) {
  9.       $('p#hideMe').slideDown('slow');
  10.     } else {
  11.       $('p#hideMe').slideUp('slow');
  12.     }
  13.   },
  14.   setup: function() {
  15.     $('#check').change(hideTest.hidePara);
  16.   }
  17. };
  18. $(hideTest.setup);
  19.     </script>
  20.   </head>
  21.   <body>
  22.     <input type="checkbox" id="check" checked="checked"/>
  23.     <label for="check" id="checkLabel">Show Details</label>
  24.     <p id="hideMe">I'm a paragraph of details.</p>
  25.  </body>
  26. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement