/Ugly/ + 'JavaScript'

A place for ugly, silly, or just-plain-crap JavaScript.

changeTheClass, with bonus IE workaround

I’ll let this one speak for itself:

function changeTheClass(theElement, theClass)
{
	if(document.getElementById(theElement))
	{
		document.getElementById(theElement).setAttribute('class',theClass);
		document.getElementById(theElement).setAttribute("className",theClass); //IE workaround
	}
}
Posted by James on 19 Sep 2011 | linky

Subscribe or follow @UglyJS!
.........
Fork then send a pull request to contribute.