var eval_table = document.getElementsByClassName("evaluation_table");
console.log(eval_table);
This displays as:
[item: function, namedItem: function]0:
table.widefat.fixed.evaluation_table
length: 1
__proto__: HTMLCollection
However, when I try to get a length of eval_table
, eval_table.length
, it returns a value of 0
. I've used this approach before, had no issues with this approach before. Is there anything wrong with what I'm trying to achieve above?
head
, so it executes before the elements are in the DOM (logs an empty array and0
for length), but once you expand the collection in console the elements show up, because it shows the state of the object at the moment of expasion, and it is a live collection.