.innerHeight()
methodThe .innerHeight()
method in jQuery is used to get/set the inner height (including padding but not border) of the matched element.
.innerHeight()
method Syntax.innerHeight() .innerHeight(value) .innerHeight(function)
Parameter | Type | Description |
---|---|---|
value |
String,Number | the height value to set |
funtion(index, oldHeight) |
Function | a function returning the inner height to set. index is the position of the element in the set.(based on 0) oldHeight is the old inner height. |
.innerHeight()
Get the current computed inner height(including padding but not border) of the first matched element.(If the element is not visible, the height would be 0 )
Get the inner height of the first paragraph
$("p").innerHeight();
.innerHeight(value)
Set the inner height(including padding but not border) of every matched elements.
Set the innerHeight of each p to 30px
$("p").innerHeight(30);
.innerHeight(function)
Set the innerHeight of the element to 10px higher than the previous.
$("p").innerHeight(function(index,oldValue){ return 10*index + oldValue; });
Try now
Result: