Learn jQuery

jQuery height()

jQuery height() method is used to sets or gets the height of the matched elements.

Syntax

jQuery.(selector).height() // Return the height for the matched elements jQuery.(selector).height(value); // Set the height for the matched elements

Example

HTML
<!DOCTYPE html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"> </script>
<title>jQuery height() Example </title>
</head>
<div>Hello, I am div. </div>
<input type="button" value="Press Me" id="pressMe">
<div></div>
</html>
Javascript
$(document).ready(function(){
$("#pressMe").click(function () {
alert($("div").height());
});
});