Revision: 49629
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at July 27, 2011 02:19 by alberomo
Initial Code
function addClass(element,value) { if (!element.className) { element.className = value; } else { newClassName = element.className; newClassName+= " "; newClassName+= value; element.className = newClassName; } }
Initial URL
Initial Description
Description: A function that add a class to an element if the element doesn't have anyone, if it already has one, add a new class name. Arguments: The elemento to which you want to add the class and the name of the class you want to add. From book Dom Scripting by Jeremy Keith.
Initial Title
addClass function
Initial Tags
javascript, style
Initial Language
JavaScript