var all = document.getElementsByClassName('someClass'); for (var i = 0; i < all.length; i++) { all[i].style.color = 'red'; }