Introduction:

In this article we will learn how to get outer Height of html elements or how to use outerHeight() method in jQuery with example.

Description:

The jQuery outerHeight () funtion is used to return the outer height of first matched html element. This method includes padding and border both.

Let’s see, Example of jQuery outerHeight() method:

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Example of jQuery outerHeight method</title>
    <script type="text/javascript" src="https://code.jquery.com/jquery-1.10.2.js"></script>
    <script>
        $(document).ready(function () {
            $("button").click(function () {
                $('p').text("Outer height of div is: " + $("div").outerHeight());
            });
        });
    </script>
</head>
<body>
    <div style="height:100px;width:300px;padding:10px;margin:3px;
     border:1px solid blue;background-color:lightpink;"></div><br>
    <button>Click here to get the outer width of the div</button>  <br />
    <p></p>
</body>
</html>

 

 Let's check live example

0 comments


Leave a comment

Make sure you enter the (*) required information where indicated. HTML code is not allowed.

You may also like