jQuery | outerHeight() Method

The outerHeight() method in jQuery is used to find the outer height of the specified element. Outer height of an element includes padding and border.

Syntax:

$(selector).outerHeight(includeMargin)

Parameters: This method accepts single parameter includeMargin which is optional. It contains boolean value and used to specify whether the margin to be included or not. If includeMargin is set to true then margin included otherwise margin not included. By default the includeMargin set to false.

Below example illustrates the outerWidth() method in jQuery:

Example: This example display the outer height of an element.

filter_none

edit
close

play_arrow

link
brightness_4
code

<!DOCTYPE html>
<html>
  
<head>
    <script src=
    </script>
      
    <!-- Script to return outer height -->
    <script>
        $(document).ready(function() {
            $("button").click(function() {
                alert("Outer height of div: "
                    + $("div").outerHeight());
            });
        });
    </script>
      
    <!-- Style to create box using padding
            and margin -->
    <style>
        .geeks {
            height: 80px;
            width: 200px;
            padding: 5px;
            margin: 5px;
            border: 2px solid black;
            background-color: green;
            text-align: center;
        }
    </style>
</head>
  
<body>
  
    <div class="geeks">
        GeeksforGeeks
    </div>
  
    <button>Click Here to display outer height</button>
  
</body>
  
</html>                    

chevron_right


Output:
Before Click on the button:

After Click on the button:



My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.




Article Tags :

Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.