Prototype This page is part of the Prototype JavaScript framework documentation.
Overview | (...)

Element.classNames returns the name of the class associated with element. Returns an empty string if there is no class associated with element.

Availability

script.aculo.us V1.5_rc5
Prototype V1.4.0_rc3

Syntax


  Element.classNames(element);

Example


<a href="#" onclick="alert('Class name is:\n' + Element.classNames('test')); return false;">
Find out what the below paragraph's class is.</a>

<p id="test" class="fantastic">This is the best paragraph ever written!</p>

creates:

Find out what the below paragraph's class is.

This is the best paragraph ever written!