16

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> 
crosenblum
  • 1,869
  • 5
  • 34
  • 57

8 Answers8

21

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

Mohith Thimmaiah
  • 857
  • 1
  • 9
  • 21
  • 6
    Thank you, I am getting the same error still on IE8 and jQuery 1.6.2, total head scratcher, not sure how long it would taken me to figure it out. Damn IE. – Bob Nov 29 '11 at 01:41
  • See here: http://stackoverflow.com/questions/2308134/trim-in-javascript-not-working-in-ie – Marco Panichi Apr 05 '13 at 09:02
10

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

Warren
  • 1,903
  • 1
  • 21
  • 30
3

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

rroche
  • 1,262
  • 1
  • 13
  • 29
  • 2
    When the error is thrown and the debugger breaks on the error, click the "step out" button repeatedly until the debugger is displaying the code you wrote. This will give you an idea of where your code is breaking, and should provide some sense of the state the app is in when the error is thrown. – MrOodles Apr 16 '12 at 21:44
2

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.

crosenblum
  • 1,869
  • 5
  • 34
  • 57
  • Odd fix for sure. I was facing a similar situation (script in ie8) and your solution here, simply putting `var `, fixed my issue as well. This is odd also because there are multiple variables in a plugin's code (my problematic code/function) and only the first `object` was throwing the error. I only added `var= ` to the first and the exception wasn't thrown any longer. – id.ot Jan 20 '14 at 21:11
0

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.

Wingy
  • 43
  • 5
0

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

0

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));
danrichards
  • 203
  • 3
  • 4
0

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.

Sirko
  • 72,589
  • 19
  • 149
  • 183