When an element has more than one class it works if you use document.getElementsByClassName
passing only one of the classes?
If I have an element like:
<div class="class1 class2 class3 ..."></div>
Can I get this element this way?
document.getElementByClassname("class1")[i];
And if I do element.className = "class";
will it delete all the classes that this element had or will it add one?
And to add is using +=
, correct?