jQuery - Object Expected on IE and $(document).ready(function() {});

Dutchie432 picture Dutchie432 · Nov 16, 2010 · Viewed 16.7k times · Source

I have a page ([LINK REMOVED]) that works completely well in FireFox and Chrome, but for some reason I am getting an "Object Expected" error in most, if not all versions of IE.

The error occurs on the line

$(document).ready(function() {
    //^ Error occurs here ^
    ...
}

I am using jQuery Tools, which implements jQuery 1.4.2, as well as some additional stuff.

I've done some reading around. I've tried to put the ready function at the end of the code, right before the </body> tag - in addition, I've tried implementing a timer to let IE load before executing, and I can not shake this error.

Answer

Ken Redler picture Ken Redler · Nov 16, 2010

Here's one problem that can cause IE to choke where other browsers may not:

$('#' + resultDivName).animate({
  height: '300px', // <=== TRAILING COMMA
}, 500, function() {
  // Animation complete.
});  

Then, in your qtip call, you have:

target: 'popPart_WM300BP'

I believe target takes a jQuery DOM object, not a string. DebugBar points to this line as the cause of "object expected".

Finally, it looks like this version of jQuery Tools includes jQuery 1.4.2. Perhaps 1.4.3 or 1.4.4 would be worth a try.