getElementsByClassNamegets live nodeList of all elements with the class default, nodeList is updated as the elements change.
default, live nodeList, , , , , 1.
, , , , .
var list = document.getElementsByClassName("default");
for(var i=list.length; i--;) {
list[i].classList.add("red");
list[i].classList.remove("default");
}
, querySelectorAll
var list = document.querySelectorAll(".default");