Skip to main content

Tedshd's Dev note

JavaScript - get element height

Table of Contents

# JavaScript - get element height

If we want get element height use JavaScript We can use clientHeightoffsetHeight or scrollHeight

console.log(document.getElementById('div').clientHeight);
console.log(document.getElementById('div').offsetHeight);
console.log(document.getElementById('div').scrollHeight);

Refer - Element - Web API Interfaces | MDN