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 fixing a template created by somebody else who forgot to include the doctype.
If you don't declare the
doctype
IE8 does strange things in Quirks mode.The onload event does not always work on IE7/8 in
<head> ... </head>
You can force it by adding an onload script at the end of your page before the tag as below.
I had the same problems.
I solved it verifying that IE8 was not configured correctly to reach the SRC URL.
I changed this, it works right.
The solution in my case was to take any special characters out of the URL you're trying to access. I had a tilde (~) and a percentage symbol in there, and the $.get() call failed silently.
Write "var" before variables, when you define them. IE8 dies when there is no "var".
Correction:
Check your script include tag, is it using
change to