Could someone please explain why this code is not functioning correctly?
var leftPos = (10 * 20) + "px";
function setPosition() {
$("#Position5").css('left','(' + leftPos + ')');
}
window.onload = function() {
setPosition ();
};
Markup
<span id="Position5">hello</span>
When I replace the variable with a pixel value, it works fine. However, I'm struggling to pass the variable through properly.
Appreciate any help on this matter. Thank you.