I am trying to get my jQuery functions to work on IE8. I am loading the library from Google's servers (http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js).
The $(function(){})
is never called. Instead, I get an error Object expected
. I opened the developer and ran typeof $
in the console, and it came up as undefined
.
I have tried going to other sites that I know use jQuery (jquery.com), and those all work, is there something I might be missing here?
I was having a similar issue. Things worked in IE6, Firefox, and IE8 running in IE7 compatibility mode; but not in 'normal' IE8. My solution was to put this code in the header
As to why jquery isn't working in IE8 I'm unclear.
The solution is to upgrade to the latest version of jQuery. I had the exact same problem and upgraded to 1.4.2 and it all works fine again in IE8.
Seems to be totally backwards-compatible with all the jQuery 1.3.2 stuff I did as well so no complaints here!
Some people stumbling on this post might get this issue with jquery and IE8 because they're using >= jQuery v2. Use this code:
jQuery is not being loaded, this is not likely specific to IE8. Check the path on your jQuery include. statement. Or better yet, use the following to the CDN:
I had the same issue. The solution was to add the link to the JQuery file as a trusted site in IE.
If you are using HTTPS on your site, you will need to load the jQuery library from Googles https server instead. Try this: https://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js (or the latest https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js)