I have a line of Javascript that is meant find all the HTML elements with the class "OldClassName" and replace their class with "NewClassName" however this line of code only replaces the first instance in the resulting array because of index [0]. How would I replace all the instances of "OldClassName" at once?
document.getElementsByClassName("OldClassName")[0].className = "NewClassName";