On Sep 9, 2006, at 7:27 AM, kevdotbadger wrote: > It dont work sorry! > .... > any ideas? Also whats the deal with 'javascript:void(0)'? whast > that do?
Hi, there are a couple things you can do to make this work. 1. wrap your jquery code in $(document).ready( 2. add "return false;" to your click events. 3. by adding "return false;" you can get rid of the ugly "javascript:void(0)" in your href. What you put in the href is up to you, but you should consider "graceful degradation" when users have javascript turned off. I grabbed your example below and dropped it into a page on my site so you can see a functioning example. Just view source from the page and copy and paste what you want: http://sandbox.englishrules.com/show- hide.htm Cheers, Karl _______________________ Karl Swedberg www.englishrules.com www.learningjquery.com > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 TRANSITIONAL//EN"> > <html> > > <head> > <title></title> > <script type="text/javascript" > src="jquery-latest.pack.js"></script> > <script type="text/javascript"> > $('#showCommentBox').click(function() { > $('#addcomment:hidden').slideDown(); > }); > $('#hideCommentBox').click(function() { > $('#addcomment').slideUp(); > }); > </script> > <style> > #addcomment { > display: block; > border: 1px solid red; > width: 300px; > > } > </style> > </head> > <body> > javascript:void(0) Show Comment Form > <div id="addcomment"> > safglkjahdsgakljfhgad glkaf hj aflkjg haf g jk lkj aglj > javascript:void(0) Hide Comment Form > </div> > </body> > </html> > > > _______________________________________________ jQuery mailing list [email protected] http://jquery.com/discuss/
