jQuery issue in Internet Explorer 8

Tim Cosgriff picture Tim Cosgriff · May 18, 2009 · Viewed 269.2k times · Source

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?

Answer

asd picture asd · May 6, 2010

Write "var" before variables, when you define them. IE8 dies when there is no "var".