innerHeight method in jquery
This method is used to return the inner height of the Element. It also includes the padding of the element.
- <html>
-
- <head>
- <style>
- p {
- border: 2px solid blue;
- padding: 10px;
- }
- </style>
- <script src="http://code.jquery.com/jquery-latest.js"></script>
- </head>
-
- <body>
- <p>My Name is Mahak</p>
- <p></p>
- <script>
- var x = $("p:first");
- $("p:last").text("innerHeight of the previous Paragraph:" + x.innerHeight());
- </script>
- </body>
-
- </html>
In this example, we take two Paragraphs. The second Paragraph will show the inner height of the first Paragraph.
- $("p:last").text( "innerHeight of the previous Paragraph:" + x.innerHeight() );
Output: