Name
className — NN n/a IE 4 DOM 1
Synopsis
Read/Write
An identifier generally used to associate an element with a style
sheet rule defined for a class selector. You can alter the class
association for an element by script. If the document includes an
alternate class selector and style rule, adjusting the
element’s className
property can provide a
shortcut for adjusting many style properties at once.
Example
document.all.elementID
.className = "altHighlighted"
Value
Case-sensitive string. Multiple class names are space-delimited within the string.
Default
None (or class set via the element’s CLASS
attribute).
Get Dynamic HTML: The Definitive Reference now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.