Description
The .height() method sets or returns the height of the selected element.
Return Height
Returns the height of the FIRST matched element.
v1.0
This method has the form:
.height()
Return Value
This form returns an Integer object.
Set Height
Sets the height of ALL matched elements.
v1.0
This method has the alternate form:
.height(value)
Parameter | Description |
---|---|
value | (required) Specifies the height in px, em, %, etc. (default = px) |
Return Value
This form returns a jQuery object.
Set Height Using a Function
Using a function to set the height of ALL matched elements.
v1.4.1
This method has the alternate form:
.height(function(index,oldheight))
Parameter | Description |
---|---|
function(index, oldheight) | Specifies a function that returns the new height of selected elements.
|
Return Value
This form returns a jQuery object.
Examples
Set the height of all p elements:
$("button").click(function(){
$("p").height(50);
});