I'm trying to add a css property to an element with the following command:
$(".pinned").css("left",colPositionLeft);
colPositionLeft
is calculated when the page is loaded.
The problem is that the .pinned
class is not present in the DOM when the page is loaded, pinned class is add to an element after the user had scroll. So, the command doesn't work.
How can I set the .pinned
css property when the page is loaded but not present in the DOM?