Advertisement
pushpesh4u

Show hide selected list

Jun 20th, 2012
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 0.58 KB | None | 0 0
  1. <html>
  2.     <head></head>
  3.     <body>
  4.         <ul>
  5.           <li><div>1</div></li>
  6.           <li><div>2</div></li>
  7.         </ul>
  8.         <ul>
  9.           <li><div>3</div></li>
  10.           <li><div>4</div></li>
  11.           <li><div>5</div></li>
  12.         </ul>
  13.         <ul>
  14.           <li><div>6</div></li>
  15.           <li><div>7</div></li>
  16.         </ul>
  17.         <script type="text/javascript" src="http://code.jquery.com/jquery-1.7.1.min.js"></script>
  18.         <script type="text/javascript">
  19.         $( 'ul li' ).click( function( e ) {
  20.                 // by default, hide all li's
  21.             $( 'ul li' ).hide();
  22.                 // show only the selected li
  23.             $( this ).show();
  24.         });
  25.         </script>
  26.     </body>
  27. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement