Posted By

damarev on 07/17/06


Tagged


Versions (?)

Who likes this?

10 people have marked this snippet as a favorite

meth
jkochis
nicolaspar
visualAesthetic
Knarf
irm
LeslieOA
seanpowell
aegony
guo3823538


addClass


 / Published in: JavaScript
 

  1. function addClass(element, value) {
  2. if (!element.className) {
  3. element.className = value;
  4. } else {
  5. var newClassName = element.className;
  6. newClassName += " ";
  7. newClassName += value;
  8. element.className = newClassName;
  9. }
  10. }

Report this snippet  

You need to login to post a comment.