Javascript custom addClass of method
- 2020-03-30 03:04:45
- OfStack
//Element: the element that needs to be added with a new style, value: the new style
function addClass(element, value ){
if (!element.className){
element.className = value;
}else {
newClassName = element.className;
newClassName+= " ";
newClassName+= value ;
element.className = newClassName;
}
}