how to get element height in Vue.js

1.6k Views Asked by At

i'm trying to get offsetHeight of element but i got undefined.

with this i get html collection and everything works right:

document.getElementsByClassName("plyr--full-ui");

enter image description here

but if i add .offsetHeight i got undefined.

document.getElementsByClassName("plyr--full-ui").offsetHeight;

what is wrong?

1

There are 1 best solutions below

3
Aurimas On

HTMLCollection is array-like object. This will get first element offsetHeight:

document.getElementsByClassName("plyr--full-ui")[0].offsetHeight;