473,508 Members | 2,159 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

jQuery hide on load issue

384 Contributor
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 3273
gits
5,390 Recognized Expert Moderator Expert
what about:
Expand|Select|Wrap|Line Numbers
  1. <body onload="$("span:first").hide();">
kind regards
Apr 29 '10 #2

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

Similar topics

13
2228
by: jeff | last post by:
I am attempting to be able to show and hide a form called viewAllForm. I declared an instance of the form in a module. Public viewAllForm As New frmViewAll However I keep getting runtime errors...
3
3070
by: poe | last post by:
Hello, I've used the jQuery PNG fix on a website I'm working on, but the PNG images seem to be distorted "only sometimes" in IE6 and IE7. It seems to happen most often when the page is loaded for...
1
49852
by: mikeh3275 | last post by:
I'm new to developing in jQuery, so I'm probably doing this wrong. I'm loading a form into a modal dialog box and I'm trying to assign a click event to the button in the form, but I can't seem to...
83
4112
by: liketofindoutwhy | last post by:
I am learning more and more Prototype and Script.aculo.us and got the Bungee book... and wonder if I should get some books on jQuery (jQuery in Action, and Learning jQuery) and start learning about...
1
2303
by: somnamblst | last post by:
This function swaps images between a close & replay GIF. Line 12 has a speed of 1 second specified for the slideDown, but no speed specified for the slideUp so it is defaulting to normal. I tried...
26
3102
by: RobG | last post by:
Do some of the regulars here need to re-think their (sometimes strident) opposition to libraries? Both Microsoft and Nokia have announced support for jQuery. It seems to have gained quite a bit...
53
8315
by: souporpower | last post by:
Hello All I am trying to activate a link using Jquery. Here is my code; <html> <head> <script type="text/javascript" src="../../resources/js/ jquery-1.2.6.js"</script> <script...
0
1362
by: zeckdude | last post by:
Hi, I am having some issues with my site. I have a main Nav with four links that load in 4 different sections. You can see the page I am working on here:...
6
8602
by: aaronkmar | last post by:
Trying to get a loading image to spin while the query is loading. I can get the data div to fade in, but I can't seem to figure out how to get the gif while the query is loading. I'm using two...
3
4014
by: jmeyer5csc | last post by:
i am using jquery to display a working... div to show the user that the query is doing something. to show.... Sys.Application.add_init(function() { ...
0
7225
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7124
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7385
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
5629
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5053
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4707
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3195
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3182
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
418
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.