I've looked through the plethora of articles about making an array from a NodeList (in this case, document.getElementsByClassName()
) in order to iterate and modify the className
property on each node...however I cannot accomplish any kind of change. Seems a bit ridiculous, but here is the code:
EDIT: The problem appears to be related to creating an Array from document.getElementsByClassName
. It's creating something that looks like an array, but isn't truly an Array. See screenshot below.
var cols = document.getElementsByClassName('cell symmetry');
[].forEach.call(cols, (node) => {
node.className += ' transiting';
console.log(node.className);
});
cols
returns an array of table cells. But using the assignment operator or trying to append another class onto the node does nothing. have tried document.querySelector
, while loops, for loops, Array.prototype.slice.call...
, but no dice.
Screenshot of the console: