I hav a certain style sheet for a div. Now i want to modify one attribute of div dynamically using js.
How can i do it?
document.getElementById("xyz").style.padding-top = "10px";
Is this correct?
In addition to other answers, if you want to use the dash notition for style properties, you can also use:
document.getElementById("xyz").style["padding-top"] = "10px";
1.4m articles
1.4m replys
5 comments
57.0k users