Reputation: 253
I am a noob of jQuery, and I have tried the following code but doesn't work. Can anyone tell me how to assign leftValue to "left" as following code using jQuery?
var i =0;
var leftValue = seat_xcoord*20;
$('#seat'+i).css({left: $leftValue});
Cheers.
Upvotes: 2
Views: 79
Reputation: 55750
Try this
$('#seat'+i).css({left: leftValue + 'px'});
You had $leftValue instead of leftValue
And make sure there is element with id="seat0"
Upvotes: 8
Reputation: 17487
Remove the $ from your leftValue variable and concatenate "px" for pixel units.
Upvotes: 0