I'm relatively new to javascript and am trying to find out why the text content of an element isn't changing when it should. I just want the text content of the '+' to change when clicking the 'click me' button.
The element should change. Why doesn't it work here? A detailed explanation would be very helpful after reading a related post. Thanks for any help.
function change() {
var btnToChange = document.getElementsByClassName("testBtn");
btnToChange.innerHTML = "it changed!";
}
<button class="testBtn">+</button>
<button class="testBtn2" onclick="change()">Click to Change</button>