jQuery Tutorial Tutorials - jQuery .innerHeight() method

jQuery .innerHeight() method

The .innerHeight() method in jQuery is used to get/set the inner height (including padding but not border) of the matched element.

jQuery .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 )

example

Get the inner height of the first paragraph

$("p").innerHeight();

Try now

.innerHeight(value)

Set the inner height(including padding but not border) of every matched elements.

example

Set the innerHeight of each p to 30px

$("p").innerHeight(30);

Try now

.innerHeight(function)

example

Set the innerHeight of the element to 10px higher than the previous.

$("p").innerHeight(function(index,oldValue){
    return 10*index + oldValue;
});

Try now
Result:
jQuery_innerheight_method

Date:2019-08-20 15:27:35 From:www.Lautturi.com author:Lautturi