Hello Readers,
innerHeight() is the jquery method which is used get or computed the innerHeight of the jquery matched element, this method including padding while computing innerHeight of the element but not consider the border and margin of the element.
Syntax :
$(selector).innerHeight()
In the above syntax there is no parameter inside innerHeight() method
Code Example :
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("button").click(function(){
alert("Inner height of div: " + $("div").innerHeight());
});
});
</script>
</head>
<body>
<div style="height:100px;width:300px;padding:10px;margin:3px;border:1px solid blue;background-color:lightblue;"></div><br>
<button>Display the inner height of div</button>
<p>innerHeight() - returns the inner height of an element (includes padding).</p>
</body>
</html>
In the above code when we click on button it get the inner height of the div section of an element including padding but not border and margin of the div in jquery.
0 Comment(s)