IE9 Javascript Error :: Undefined/Null-Collection of common programming errors
I have a piece of JS (below) that in IE9 is giving me the following error:
The value of the property ‘$’ is null or undefined, not a Function object
In FFX, Chrome, and Safari I get no issues. Not sure whats going on here – still learning a bit, so be easy on me if it’s obvious 🙂
Thanks in advance!
function LA_triggerOverlay() {
$("#la-w-001-overlay").toggle();
};
$(function () {
$("#sample-widget").show();
});
-
In latest versions of chrome and FF [and maybe Safari as well] ‘$’ is natively supported as a synonym for document.getElementById()
IE 9 does not support this natively, hence you get the error you stated.
However, as gentleman above points out, you maybe missing a library [most likely jQuery]. I would highly suggest to include jQuery in your page and try the code again.
You can reference jQuery easily via this snippet:
So if this is the missing piece, it should solve your problem.
-
Presumably you haven’t included a script above that code that defines the
$
symbol (e.g., jQuery or similar). There is no default$
symbol, it’s just a symbol that’s used by a couple of popular libraries (jQuery, Prototype, and MooTools primarily). Unless you include one of those with ascript
tag above your code, you’ll get this error — in any browser.
Originally posted 2013-11-09 19:26:14.