Reputation: 2944
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
Upvotes: 0
Views: 327
Reputation: 123
That script won't execute because the opening tag isn't closed:
<script type="text/javascript?
ought to be
<script type="text/javascript">
Upvotes: 2
Reputation: 42040
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.
Upvotes: 1
Reputation: 12666
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
Upvotes: 1
Reputation: 12666
If you want to do it onload, why not do it in css?
#secondpage,
#thirdpage {
display:none;
}
Upvotes: 3