Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to deal with ie8 jquery object doesn't support this property or method Error?

This doesn't indicate any error in my javascript code, but in the downloaded jquery.js file, that is a renamed minified jquery 1.3.2 file.

I am testing some js code, in IE8 that works 100% in firefox and google chrome, before rolling it to production server.

But the jquery library itself seems to have issues inside IE8.

I even tried downloading a new copy of 1.3.2 jquery, and using that instead of the minified version, and it still errors out.

Then I tried using a the cdn hosted on at code.jquery.com, and it still errored out before even getting to letting my code work or not work.

It appears to partially work in IE8, but other jquery on our dev server partially works, and keep's re-iterating, "Object doesn't support this property or method"

Is there a specific version of jquery that works best in IE8? At least so I can see if there is an issue with my code or not in IE8?

Or is there a list of jquery functions that don't work in IE8?

P.S. Also, I considered upgrading to IE9, to see if that had the same issue, but you can't download IE9, for WinXP, which sucks. I just like WinXP, and there's very little chance of upgrading. Before I had XP, I had Vista on my work pc, which really tanked.

Sorry for little vent, just trying to get this code working and error free...

Thank You.


from comment

<!--- Include jQuery --->
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js" charset="utf-8"></script> 
like image 384
crosenblum Avatar asked Mar 02 '11 21:03

crosenblum


4 Answers

I was getting this prob when I was using xxx.trim() instead of $.trim(xxx). Once I switched this prob went away.

like image 134
Mohith Thimmaiah Avatar answered Nov 06 '22 10:11

Mohith Thimmaiah


Note: some may also arrive at this page by trying to use jQuery 2 with IE8. jQuery 2 drops support for IE8 (see: http://jquery.com/browser-support/).

If you need support for IE8, use the latest version of jQuery 1

like image 45
Warren Avatar answered Nov 06 '22 10:11

Warren


In my experience, jQuery is rarely the issue regardless of the version you might be running, what i typically do to get those nasty bugs out of the way, is to disable|remove any other javascript that you are running on the site (besides jquery), then start enabling 1 by 1 in conjunction with jquery, once you find where the error is hitting try to debug that script, 1 thing that has been really helpful in the past is to do jslint or jshint, if you are not familiar with those tools, they are tools that will help you validate your code and will recommend you improve some of your statements, based on previous developer experiences, JSLint is a more strict tool, i think JSHint will help you a little bit more as it is a little more forgiving in some aspects.

Let me know if that was helpful, also try to install IE8 Developer tools :)

like image 26
rroche Avatar answered Nov 06 '22 10:11

rroche


Basically there was a weird issue in my code, about declaring a variable.

So this had nothing to do with jquery loading, but it wouldn't in any way show an error message related to a line in my code.

As soon as I declared the variable above the logic, it worked, error free.

Thanks to everyone for trying.

like image 2
crosenblum Avatar answered Nov 06 '22 11:11

crosenblum