function getHeight(element) {
console.log(element);
var offsetHeight = document.getElementsByClassName(element).offsetHeight;
console.log(offsetHeight);
}
getHeight("card-1");
Although it correctly prints the element to the console with just document.getElementsByClassName(element)
but I can't get to the offsetHeight property, even with document.getElementsByClassName(element)[0].offsetHeight
Do I have to run a loop?
See Question&Answers more detail:os