I have the following javascript code (pure js, no libs), however when its run it only returns one element instead of two
function changeButtonStyles() {
var actualButtons = document.getElementsByClassName("read-more");
for (var i = 0; i < actualButtons.length; i++) {
actualButtons[i].parentNode.className = "basic";
actualButtons[i].className = "btn btn-xs btn-default";
}
It should return two elements from the page so I can modify them both, but it only returns the one or the loop only iterates through one. Why is this?