var list = document.getElementsByClassName("contentME"); for (var i = 0; i < list.length; i++) { list[i].className = "contentFirstME"; }