outerHeight() Method - Javascript jQuery Method and Property

Javascript examples for jQuery Method and Property:outerHeight

Description

The outerHeight() method returns the outer height including padding and border of the FIRST matched element.

Syntax

Parameter RequireData TypeDescription
includeMargin Optional. A Boolean value whether to include the margin

The following code shows how to Return the outer height of a <div> element:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
    $("button").click(function(){
        console.log("Outer height of div: " + $("div").outerHeight());
    });//from   w  w  w .j  a v a 2  s .  c  om
});
</script>
</head>
<body>

<div style="height:100px;width:200px;padding:10px;margin:3px;border:1px solid blue;background-color:red;"></div><br>

<button>Display the outer height of div</button>

</body>
</html>

Related Tutorials