Javascript Reference
Categories: Element

javascript Element className

@March 15, 2008, 1:22 a.m.
className NN 6 IE 4 DOM 1  

Read/Write  

This is 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.getElementById("elementID").className = "altHighlighted";
 
Value

Case-sensitive string. Multiple class names are space-delimited within the string.

 
Default

Empty string.


Powered by Linode.