css - jQuery chaining -
i don't think i'm correctly understanding jquery chaining. i'm looping through array , trying add div elements wrapper css class each div element having class of 'click' , custom css top , left attributes, this:
$('<div></div>').appendto('.wrapper').addclass('click').css('top',click.y).css('left'.click.x); but fails work expected - adds 1 div element, sets .wrapper div's class 'click' , stops.
if remove
.css('top',click.y).css('left'.click.x); it works expected - adding new div elements wrapper div.
how can work properly? thanks
use json object .css.
.css({    'left' : click.x,    'top' : click.y  }); 
Comments
Post a Comment