How to Style an Element using Javascript
If you need to style an element using Javascript then you can use the style
object to support all your CSS needs.
If you need to do this purely in a Javascript file itself, then:
Note that where CSS properties would use dashes
to separate words, like background-color
, Javascript instead uses camel casing and drops the space.
Example: background-color
would become backgroundColor
.