crosenblum
crosenblum

Reputation: 1927

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> 

Upvotes: 16

Views: 55527

Answers (8)

danrichards
danrichards

Reputation: 223

This will also happen if you are trying to use ES5 .bind on a callback with your jquery.

$('#ref').on('click', function() { 
    // do stuff 
}.bind(this));

Upvotes: 0

Chris Butterworth
Chris Butterworth

Reputation: 106

I had this issue with a variable called form changing that tiny thing fixed it.

Upvotes: 0

Warren
Warren

Reputation: 2044

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

Upvotes: 10

Wingy
Wingy

Reputation: 43

I was experiencing the sames issue, in my case was caused by chaining trim() onto text() functions in ie8

Offending Code was $("td:eq(n)", this).text().trim();

Changed to: $.trim(("td:eq(n)", this).text());

Now working.

Upvotes: 0

Kaleem Ullah Khan
Kaleem Ullah Khan

Reputation: 1

It could be many reasons but I was facing the same error and I was using

.html().trim();

when I changed it to

.html()+""; 

it resolved the issue. check the error line and if you are using .trim() after .html(), remove it.

Upvotes: 0

Mohith Thimmaiah
Mohith Thimmaiah

Reputation: 857

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

Upvotes: 21

crosenblum
crosenblum

Reputation: 1927

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.

Upvotes: 2

rroche
rroche

Reputation: 1272

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 :)

Upvotes: 3

Related Questions