jQuery chaining

I don't think I'm correctly understanding jQuery chaining. I'm looping through an array and trying to add div elements to my wrapper CSS class with each div element having a class of 'click' and custom css top and left attributes, like this:

$('<div></div>').appendTo('.wrapper').addClass('click').css('top',click.y).css('left'.click.x);

But it fails to work as expected - it adds one div element, sets my .wrapper div's class to 'click' and then stops.

If I remove

.css('top',click.y).css('left'.click.x);

it works as expected - adding new div elements to the wrapper div.

How can i get this to work properly? Спасибо

8
задан BoltClock 23 February 2011 в 17:50
поделиться