null exception in javascript
I met with the following error from the following javascript functions, any ideas what is wrong?
BTW: since the whole page is long, I can not post them all here. I am trying to find a small but complete sample to reproduce this issue. Any ideas to debug further to find the root cause?
'Null' is null or not an object
Script:
<script>
$(document).ready(function() {
$("#tag0"开发者_StackOverflow中文版).tooltip({ effect: 'slide'});
});
</script>
thanks in advance, George
My first guess was that
$("#tag0")
is returning null, and attempting to call a method on null is probably giving you the error. I have been informed that jQuery won't actually return null if your selector doesn't match anything -- you just get an empty set of results with a length property of 0. If you call a nonexistent method on an object of this result type, perhaps you get the error message you're seeing.
Is it possible there isn't actually an element on the page with ID "tag0"? Should it be a class instead (".tag0" instead of "#tag0")?
精彩评论