Giffyguy
Giffyguy

Reputation: 21302

How can I calculate the rendered height of an HTML table, from within JavaScript?

When the window is resized, I need to know how big the table is, so I can dynamically fit everything else nicely in-between. The table height is solely dependant on the contents, which are loaded dynamically. How do you calculate the rendered height of the table in JavaScript?

Upvotes: 5

Views: 19868

Answers (1)

BalusC
BalusC

Reputation: 1109875

You can use element.offsetHeight for this.

var table = document.getElementById("tableId");
alert(table.offsetHeight);

Upvotes: 16

Related Questions