jQuery .innerHeight() method returns current computed height for the first 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>
  <head>
    <script src="http://java2s.com/style/jquery-1.8.0.min.js"></script>
    <script type="text/javascript">
        $(document).ready(function(){<!-- w  w  w. j av a  2  s. co  m-->
             $("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





















Home »
  jQuery »
    jQuery Tutorial »




Basics
Selector
DOM
Event
Effect
Utilities