Skip to main content
added 164 characters in body
Source Link
Vaune
  • 314
  • 3
  • 13

Use jQuery's innerHeight function to get the calculated height of an element, sans border and margin.

var height = $('#myElement').innerHeight(); 

Edit: Use jQuery's outerHeight function to get the calculated height of an element, including padding, border and optionally the margin.

//without margin var height = $('#myElement').outerHeight(); //with margin var height = $('#myElement').outerHeight(true); 

Edit 2: You may also compare these results with native Javascript.

var el = document.getElementById('myElement'); var height = el.offsetHeight; 

Use jQuery's innerHeight function to get the calculated height of an element, sans border and margin.

var height = $('#myElement').innerHeight(); 

Edit: Use jQuery's outerHeight function to get the calculated height of an element, including padding, border and optionally the margin.

//without margin var height = $('#myElement').outerHeight(); //with margin var height = $('#myElement').outerHeight(true); 

Use jQuery's innerHeight function to get the calculated height of an element, sans border and margin.

var height = $('#myElement').innerHeight(); 

Edit: Use jQuery's outerHeight function to get the calculated height of an element, including padding, border and optionally the margin.

//without margin var height = $('#myElement').outerHeight(); //with margin var height = $('#myElement').outerHeight(true); 

Edit 2: You may also compare these results with native Javascript.

var el = document.getElementById('myElement'); var height = el.offsetHeight; 
Source Link
Vaune
  • 314
  • 3
  • 13

Use jQuery's innerHeight function to get the calculated height of an element, sans border and margin.

var height = $('#myElement').innerHeight(); 

Edit: Use jQuery's outerHeight function to get the calculated height of an element, including padding, border and optionally the margin.

//without margin var height = $('#myElement').outerHeight(); //with margin var height = $('#myElement').outerHeight(true);