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.
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.
Could be the url you're using for jquery.tools
. It is missing the http:
part.
//cdn.jquerytools.org/1.2.5/jquery.tools.min.js
should be
If you are testing over a HTTPS connection, check if you are choosing view only the content that was delivered securely. If you choose YES maybe the scripts will not be loaded.
Your $(document).ready
and $(function(){..}
methods are just fine - in fact when I fired up the Visual Studio debugger and attached to the page, those methods were firing as expected. The problem is that they are trying to call a function named initializePageMain()
that doesn't exist for some reason. As to why that function doesn't seem to exist... I am not sure.
I would also try "fixing" the script tag that contains this code (sidenote: why isn't doToolTips defined in your index.js file?) to read like the rest of your script tags (get rid of the language element:
<script type="text/javascript"> ... </script>
This is another gem that causes this error in IE
Math..random();
Those two dots (..) will ruin you.
来源:https://stackoverflow.com/questions/4199577/jquery-object-expected-on-ie-and-document-readyfunction