I\'m attempting to get all elements by the class of \'element\' and adding an event listener to each of them. however, getElementsByClassName()
returns and html
You could use document.querySelectorAll(".element")
instead.
This will use CSS selectors to query the dom (in this case the class "element").
var tableElements = document.querySelectorAll(".element");
tableElements.forEach(function(element) {
element.addEventListener("click", function() {
dispElementData(this);
});
});