Wednesday, December 2, 2009

[jQuery] error essage: "css is not a function"

I'm using the following code:

var boxes = $('.resizable').get(); // get divs as array
for (var i=0; i<boxes.length; i++ )
{ console.log(boxes[i].id+': left='+boxes[i].css('left')); }

I get this error message from Firebug:
boxes[i].css is not a function
[Break on this error]
{ safelog($boxes[i].id+': left='+$boxes[i].css('left'));\r
\n

I have used similar code before, but for an individual item, not an
array.
For instance, This works fine:

var sel1=$('#'+b1);
var c1x = parseInt(sel1.css('left'));

Does this simply not work on arrays, or have I made some other error?

No comments: