Can someone explain getElementsByClassName, because I thought I was using it correctly, but I am having issues. For instance, the following code doesn't make the hidden elements visible:
var actionButtons = document.getElementsByClassName("action_buttons");
for (var i=0; i < actionButtons.length; i++) {
actionButtons[i].style.visibilty = "visible";
}
Yet, if I select by Id I can change the elements' properties. Any idea what the issue is?
I only have "use strict statement" and unused variable warnings so far. And I definitely have four button elements with class="action_buttons".
If I plug in alert(actionButtons[i]); I get object HTMLButtonElement four times...
And here is the relevant HTML:
<button type="button" id="stand_button" class="action_buttons">Stand</button>
<button type="button" id="hit_button" class="action_buttons">Hit</button>
<button type="button" id="double_down_button" class="action_buttons">Double-Down</button>
<button type="button" id="split_button" class="action_buttons">Split</button>