views:

589

answers:

2

I have a page with jquery on it. It works fine in Firefox, Chrome etc but if I load it in IE, none of the Jquery functions run, and IE's script debugger shows:


Error

A Runtime Error has occurred. Do you wish to Debug?

Line: 269

Error: Unterminated string constant

Yes No

The line in question is in my (unmodified) jquery.js that is causing the error is

style.left = ret || 0;

It also shows:


Error

A Runtime Error has occurred. Do you wish to Debug?

Line: 835

Error: Invalid argument.

Yes No

With the line in question being:

ret = style.pixelLeft + "px";

Any ideas?

EDIT:

Seems I may have been looking in the wrong place for the error. If I take this out, it works:

 $(".middlebox").children("p").hide();
 $(".middlebox").addClass("middlebox_closed", "fast");
+3  A: 

The error is not necessarily in the jQuery code, but the argument value being passed as a parameter into a function in jQuery i.e. the step before.

EDIT:

This line is incorrect

$(".middlebox").addClass("middlebox_closed", "fast");

addClass() does not take 2 arguments, just one which is a string for the class that you wish to add. Change it to

$(".middlebox").addClass("middlebox_closed");

and it will work. Or maybe you wanted to add 2 classes, in which case this will work too

$(".middlebox").addClass("middlebox_closed").addClass("fast");
// or this for brevity
$(".middlebox").addClass("middlebox_closed fast");
Russ Cam
A: 
  1. (maybe) Try using style.left instead of pixelLeft Also check that style is initialised properly.
  2. What are you trying to achieve by this line? style.left = ret || 0; Maybe you wanted something like style.left = parseInt(ret)
DmitryK