HTML Editor
<!DOCTYPE html> <html lang="en-US"> <head> <style> #outerDiv{ border:1px solid black; height:150px; width:200px; overflow: auto; } #innerDiv{ height:1500px; width:2000px; } </style> </head> <body> <p>Click on the button to get the total height of the scrolling element.</p> <button onclick="myFunction()">Click Me</button> <p id="point"></p> <div id="outerDiv"> <div id="innerDiv">Some content</div> </div> <p><strong>Note</strong>: scrollHeight = padding-top + padding-bottom + height = 0 + 0 + 1500 = 1500.</p> <script> var x = document.getElementById("point"); var elem = document.getElementById("innerDiv"); function myFunction(){ x.innerHTML = elem.scrollHeight } </script> </body> </html>
OUTPUT
×

Save as Private