How to dynamically get the content height of a div using AngularJS ? Last Updated : 24 Jan, 2023 Summarize Comments Improve Suggest changes Share Like Article Like Report In this article, we will see how to get the height of the content of a <div> dynamically using Javascript, & will understand its implementation through the illustrations. The content height of a div can dynamically get using the clientHeight property and scrollHeight property depending upon the user's requirement. If a user wants to know the space required by actual displayed content including the space taken by padding but not including the scrollbars, margins, or borders, then the user can use any of the following procedures that will return the height of the entire content of an element. Element.clientHeight property: This is used to return the viewable height of an element in terms of the pixel.Element.scrollHeight property: This is used to return the height of an element.Example 1: In this example, the content Height of div using the clientHeight property will return the height of the entire content of an element. HTML <head> <script src= "https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js"> </script> <style> #div1 { height: 100px; width: 300px; border: 2px solid black; overflow: scroll; } h1 { color: green; } </style> </head> <body> <center> <h1>GeeksforGeeks</h1> <h3>Getting Content height</h3> <div id="div1"> Calculate content height of a div on GeeksforGeek. GeeksforGeeks is a computer science portal which helps students to learn various programming language and master data structures and algorithms. There are various courses available to learn new skills. </div> <br> <button onclick="contentheight()"> Content height of Div </button> <p id="p1"></p> </center> <script> function contentheight() { var ans = "Content-height: " + angular.element(document .getElementById("div1").clientHeight) + "px<br>"; document.getElementById("p1").innerHTML = ans; } </script> </body> Output: Getting the height of the content in a <div> using the clientHeight propertyExample 2: In this example, the content Height of div using the scrollHeight property will return the height of the entire content of an element. HTML <head> <script src= "https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js"> </script> <style> #div1 { height: 100px; width: 300px; border: 2px solid black; overflow: scroll; } h1 { color: green; } </style> </head> <body> <center> <h1>GeeksforGeeks</h1> <h3>Getting Content height</h3> <div id="div1"> Calculate content height of a div on GeeksforGeek. GeeksforGeeks is a computer science portal which helps students to learn various programming language and master data structures and algorithms. There are various courses available to learn new skills. </div> <br> <button onclick="contentheight()"> Content height of Div </button> <p id="p1"></p> </center> <script> function contentheight() { var ans = "Content-height: " + angular.element(document .getElementById("div1").scrollHeight) + "px<br>"; document.getElementById("p1").innerHTML = ans; } </script> </body> Output: Getting the height of the content in a <div> using the scrollHeight property Comment More infoAdvertise with us Next Article How to dynamically get the content height of a div using AngularJS ? S SHUBHAMSINGH10 Follow Improve Article Tags : Web Technologies AngularJS AngularJS-Questions Similar Reads How to dynamically get the content width of a div using AngularJS ? In this article, we will see how to dynamically get the content width of a div using AngularJS, along with understanding its basic implementation through the examples. The content width of a div can dynamically get using clientWidth and scrollWidth properties depending upon the user's requirement. I 2 min read How to empty the content of an element using AngularJS ? In this article, we will see how to remove the content of an element in HTML DOM using AngularJS. This task can be accomplished by implementing the jQuery empty() method that removes all child nodes and their content for the selected elements. Syntax: element.empty();Parameter: This method does not 2 min read How to dynamically set the height and width of a div element using jQuery ? Set the height of a div element using jQueryThe content height of a div can be dynamically set or changed using height(), innerHeight(), and outerHeight() methods depending upon the user requirement. If the user wants to change the content height of a div dynamically, it includes changing the actual 7 min read How to get file content and other details in AngularJS? We can get the file content by using some basic angular functions and other details like the name and size of the file in AngularJS. To understand it look into the below example where both HTML and JS files are implemented. Note: Consider below two files are of same component in angular. app.module. 2 min read How to get the height of a div using jQuery ? In this article, we will learn how to get the height of a div using jQuery. In jQuery, height method is used to get the height of any element in HTML. The height method sets and returns the height of the HTML elements. Method 1: The height() method returns the first matched element's height, But the 3 min read Like