Wednesday, December 2, 2009

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

Clearly boxes[i] is not a jQuery object.
you should try $(boxes[i]).css perhaps

Thanks & Regards,
Dhruva Sagar.




On Thu, Dec 3, 2009 at 1:04 AM, hsfrey <hsfrey@gmail.com> wrote:
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: