This is my code:
var lef=$(this).css("left");
var top=$(this).css("top");
alert(lef);
$(this).after("<div class='edit cancel' style='position:absolute;top:"+top+";left:"+lef+"'>Cancel</div>");
Now the statement var lef=$(this).css("left") + 150, doesn’t seem to work. I want to get the left property and add 150 pixels to it
How can i do this ?
Thanks.
Here’s the easiest way (for the general case):
http://api.jquery.com/css/#css-properties
If you need to do it “manually” (for example, as part of creating a new element):
You need to use
parseIntbecause.css('left')returns150px. You then have to put back thepxas part of the inline style.