document.classes

JavaScript 1.2+ Nav4+ Syntax

document.classes.className.tagName
						

Description

The classes property is an associative array that contains classes associated with Netscape style sheets. Using dot notation, className specifies the class attribute and associated HTML tag ( tagName ) for which the style is applied. When tagName is set to all, the style is applied to all tags with a class attribute of className. The style sheet classes are created within <style> or <script> using JavaScript or HTML.

Note

When creating a class, make sure the declaration appears before the new class is used, because many HTML objects cannot be changed once they have been created in the document.

Note

If JavaScript dot notation is used when ...

Get Pure JavaScript 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.