0

on a webpage in under developmnt i'm getting this error on IE

element = $(element);   

this code is in prototype.js

Object expected

How to get rid of this error.

Update:

jQuery is also being used on site.

Rob W
  • 341,306
  • 83
  • 791
  • 678
Jitendra Vyas
  • 148,487
  • 229
  • 573
  • 852

3 Answers3

3

Is "element" the id of your element? If so try making it element = $("element")

Tim Goodman
  • 23,308
  • 7
  • 64
  • 83
2

your statement should be

element = $("id of element")

suppose you have the following code.

<div id="mainDiv">
  ...
</div>

To access this control, in prototype, it is

element = $("mainDiv");

UPDATE:

Based on your comment, you can combine both jquery and prototype in the same page.

var J = jQuery.noConflict();

After this statement, $("#foo") will be J("#foo").

See this stackoverflow question

Community
  • 1
  • 1
Adeel
  • 19,075
  • 4
  • 46
  • 60
1

You need to put a var in front of the variable assignment when the variable and element id are the same in IE.

var element = $(element);
Minimul
  • 4,060
  • 2
  • 21
  • 18