What I'd like to do can be summarized like this: "if this condition is met, then do the following multiple actions." My code works fine for the first thing to be done, but I'm getting an "Uncaught SyntaxError: Unexpected token else" error when I add an additional action to be performed. I'll note the problem line below.
function turnonall(cl) {
var elements = document.getElementsByClassName(cl);
for (var i = 0; i < elements.length; i++){
if (elements[i].style.display == 'none' || elements[i].style.display == '' || elements[i].style.display == 'block')
elements[i].style.display = 'block';
elements[i].style.className = 'buttonactive'; <--this line is throwing the error.
else
elements[i].style.display = 'none';
}
}