As stated in the comments, adeneo's solution is not correct as it will factor in unwanted padding into the height.
To get the same dimension as jQuery's .height()
provides, this is the code you'll want to use.
const s = window.getComputedStyle(el, null),
height = el.clientHeight - parseInt(s.getPropertyValue('padding-top')) - parseInt(s.getPropertyValue('padding-bottom'));
Here is a function that will help calculate all of jQuery's height getter functions. If you want to calculate the width you'll just want to change some obvious properties in the code
function getHeight(el, type) {
if (type === 'inner') // .innerWidth()
return el.clientHeight;
else if (type === 'outer') // .outerWidth()
return el.offsetHeight;
const s = window.getComputedStyle(el, null);
if (type === 'height' || !type) // .height()
return el.clientHeight - parseInt(s.getPropertyValue('padding-top')) - parseInt(s.getPropertyValue('padding-bottom'));
else if (type === 'full') // .outerWidth( includeMargins = true )
return el.offsetHeight + parseInt(s.getPropertyValue('margin-top')) + parseInt(s.getPropertyValue('margin-bottom'));
return null;
}