Tutorial addClass Function

If you are going library-free, you might need to roll your own function like this. function addClass(id,new_class){ var i,n=0; ...

If you are going library-free, you might need to roll your own function like this.
function addClass(id,new_class){
var i,n=0;

new_class=new_class.split(",");

for(i=0;i if((" "+document.getElementById(id).className+" ").indexOf(" "+new_class[i]+" ")==-1){
document.getElementById(id).className+=" "+new_class

Hot in Week

Popular

Archive

item