Can anyone tell me why this doesn’t work?
var leftPos = (10 * 20)+ "px";
function setPosition() {
$("#Position5").css('left','(' + leftPos + ')');
}
window.onload = function() {
setPosition ();
};
Markup
<span id="Position5">hello</span>
If I replace the variable with a pixel value it works but I can’t seem to get the var to pass through?
Thanks for looking.
No need to add the brackets around
leftPos.