JS DOM: Change HTML style attribute (for CSS)

By Xah Lee. Date: .

Get style

node.style.cssProperty

Return the property value, or undefined if it doesn't exist.

Set style

node.style.cssProperty=value
  • Set CSS property.
  • Return value.
  • If the property is not a standard CSS property, it's not added.

example JS DOM: Change CSS

JavaScript DOM, Change CSS

DOM Element Methods

Get node
Loop thru nodes
Attributes
Create insert node
Delete
Change content
Event