Reputation: 44275
I want to hide a span on document.ready. I tried
<script type="text/javascript">
//Set the stuff we want to be able to use in javascript, but not display in the browser window invisible
$(document).ready(
function () {
('#_ctl0_ContentPlaceHolder1_lType').hide()
});
</script>
But, I get error "Object doesn't support this property or method" in IE7 debugger. I verified in the source that the object exists as a <span>
and the id is correct.
Upvotes: 1
Views: 17352
Reputation: 146302
Try this:
$(document).ready(function () {
$('#_ctl0_ContentPlaceHolder1_lType').hide();
});
You left off the $
.
Upvotes: 7
Reputation: 449395
It doesn't seem to be the root of your problem, but note that _
is an invalid starting character for an ID.
ID and NAME tokens must begin with a letter ([A-Za-z]) and may be followed by any number of letters, digits ([0-9]), hyphens ("-"), underscores ("_"), colons (":"), and periods (".").
Upvotes: 0
Reputation: 82893
You are missing a $ infront of the span selector. Try this:
<script type="text/javascript">
//Set the stuff we want to be able to use in javascript, but not display in the browser window invisible
$(document).ready(function () {
$('#_ctl0_ContentPlaceHolder1_lType').hide();
});
</script>
Upvotes: 3