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