[thelist] changing class style with JS

.jeff jeff at members.evolt.org
Fri Oct 25 17:22:01 CDT 2002


> From: Chris Evans
> Is there a way to change elements of a CSS class using
> Javascript?  I can easily do it using ids rather than
> classes, but I can't figure out how to change a class.
> I can't use getElementById, since I will have multiple
> elements that I want to change at the same time.

sounds like maybe you want a custom method like getElementById() or getElementByTagName(), but that retrieves all elements with the same className.

there's the beginning of some work here:


however, it's not as flexible as you might need, ie it only looks for the class in a pre-defined set of html tags and it's not actually a method of the document object.

good luck,


jeff at members.evolt.org

More information about the thelist mailing list