469,343 Members | 5,546 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,343 developers. It's quick & easy.

jQuery hide on load issue

384 256MB
i have the below source and I can't figure out how to hide the span by default when the page is loaded?

Expand|Select|Wrap|Line Numbers
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <script src="jquery.js"></script>
  5.  
  6. <style>
  7. span { float:left; background:#def3ca; padding:3px; clear:left; }
  8. </style>
  9.  
  10. </head>
  11. <body>
  12.   <a href="#" id="show">More</a>
  13.   <div>
  14.  
  15.     <span id="first">Once upon a time there were three programmers...</span>
  16.  
  17.   </div>
  18. <script>
  19.     $("#hide").click(function () {
  20.       $("span:first").hide("slow");
  21.     });
  22.     $("#show").click(function () {
  23.       $("span").show("slow");
  24.     });
  25. </script>
  26. </body>
  27. </html>
Apr 29 '10 #1
1 3191
gits
5,390 Expert Mod 4TB
what about:
Expand|Select|Wrap|Line Numbers
  1. <body onload="$("span:first").hide();">
kind regards
Apr 29 '10 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

13 posts views Thread by jeff | last post: by
3 posts views Thread by poe | last post: by
1 post views Thread by mikeh3275 | last post: by
83 posts views Thread by liketofindoutwhy | last post: by
26 posts views Thread by RobG | last post: by
53 posts views Thread by souporpower | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.