tags:

views:

56

answers:

4

Hello friends I have three div tags on my page..

I am trying to hide two div tags when initial page load

<div id="firstpage">

</div>

<div id="secondpage">

</div>
<div id="thirdpage">

</div>

my script is

<script type="text/javascript>
$(document).ready(function(){
  $("#secondpage").hide();
  $("#thirdpage").hide();
});
</script>

but I am seeing all my div tags is that something I am doing wrong here?

thanks

+3  A: 

If you want to do it onload, why not do it in css?

#secondpage,
#thirdpage {
    display:none;
}
hookedonwinter
And, like the comments suggest.. close your divs.
hookedonwinter
Preumably so they don't get stuck closed for non-JS users.
David Dorward
@David touche. I've heard of these users.
hookedonwinter
+1  A: 

That script won't execute because the opening tag isn't closed:

<script type="text/javascript?

out to be

<script type="text/javascript">
+1  A: 

your enclosing tags are wrong/missing, could be unrelated though.

EDIT:

1) Install Firebug and check under the Net->JS tab to see whether the jquery is actually loaded. I bet it isn't. There should be a separate GET request for the .js file. 2) Firebug's Console should give you errors for undefined stuff if JQuery isn't included.

Most likely you just don't have JQuery included, as others have pointed out.

Uku Loskit
+1  A: 

It looks like you're not including jQuery. There are a few ways to include jQuery -- http://www.ajaxprojects.com/ajax/tutorialdetails.php?itemid=609

hookedonwinter