Assign Or Get Class Name Attribute With JavaScript
Saturday, May 24, 2008 - 09:51
To get the class of an element with JavaScript you use the className property of the element object. Take the following section of HTML code.
<div id="adiv" class="theClass">some text</div>
Use the following bit of code to print off the class name of the div element in a message box.