Sometimes, we want to add inline style using JavaScript.
In this article, we’ll look at how to add inline style using JavaScript.
How to add inline style using JavaScript?
To add inline style using JavaScript, we set the properties in the style
object property.
For instance, we write
nFilter.style.width = "330px";
nFilter.style.float = "left";
to set the width
and float
CSS styles of the nFilter
element.
Conclusion
To add inline style using JavaScript, we set the properties in the style
object property.