.innerHeight()

In this chapter you will learn:

  1. Syntax and Description for .innerHeight()
  2. How to get inner height for a div element

Syntax and Description

.innerHeight() gets the current computed height for the first element in the set of matched elements, including padding but not border.

Its return value is the height of the element in pixels, including top and bottom padding.

This method is not applicable to window and document objects; for these use .height() instead.

Get inner height for a div

<html><!--   j  a  v a  2 s . com-->
  <head>
    <script src="http://java2s.com/style/jquery-1.8.0.min.js"></script>
    <script type="text/javascript">
        $(document).ready(function(){
             $("div").width(300);
             alert($("div").innerHeight());
        });
    </script>
    <style>
    div{
        width:200px;
        height:100px;
        overflow:auto;
    }
    h1 { width:1000px;height:1000px; }
  </style>

  </head>
  <body>
    <body>
       <div><h1>java2s.com</h1></div>
    </body>
</html>

Click to view the demo

Next chapter...

What you will learn in the next chapter:

  1. Syntax and Description for .innerWidth()
  2. How to get inner width for a div element