How to get element height including padding and borders using javascript

I would like to know how to get the height of an element, including the location and borders, using javascript, so poorly knowing the height that the element has when rendering in the browser. Can someone help me and I'm still new to javascript

+5
source share
2 answers

You are looking for element.offsetHeightand element.offsetWidth.

According to quirksmode.com , these properties work in all major browsers. Hooray!

+14
source

jQuery, , $(ele).outerHeight() , , $(ele).outerHeight(true).

. https://api.jquery.com/outerHeight/

+2

All Articles