Reputation: 22030
This is a simple jQuery code, what I want to do is hide #bling
, but it does not
<script language="javascript">
$("document").ready(function() {
$('#bling').hide();
});
</script>
<div id="bling" style="background-color:#FFFF66; width:100px; height:100px;"></div>
Thanks Dave
Upvotes: 2
Views: 170
Reputation: 6831
Works for me as it is . Try using jquery from jquery site, the code is below.
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript"></script>
<script language="javascript">
$("document").ready(function() {
$('#bling').hide();
});
</script>
<div id="bling" style="background-color:#FFFF66; width:100px; height:100px;">aaaaaaaa</div>
See if it works.
Upvotes: 1
Reputation: 10140
Make sure jQuery is loading:
<script language="javascript">
$(document).ready(function() {
alert('Can you hear me now?');
//$('#bling').hide();
});
</script>
Upvotes: 0
Reputation: 700212
I tested the code, and it works fine, eventhough you have the string "document"
instead of document
and an ancient language
attribute on the script tag...
Use type="text/javascript"
on the script tag. You can just send a function to the jQuery object as a shortcut for using the ready function:
<script type="text/javascript">
$(function(){
$('#bling').hide();
});
</script>
However, as it's not this code that is the problem, there is something else in your page that is causing it.
Check that you have successfully included the jQuery script.
Check that you don't have another element with the id "bling". An id has to be unique in the page.
Check for Javascript error messages. In IE check the status bar for a notification. In Firefox open the Javascript console.
Upvotes: 3
Reputation: 28429
Make sure you are including the jQuery core javascript file in your HTML. On top of that, your code should look more like this:
<script type="text/javascript">
$(document).ready(function() {
$('#bling').hide();
});
</script>
Note the type
attribute on the script tag as well as document
not in quotes.
Upvotes: 0