JSFiddle - React, Tailwind, and code Playground

HTML

<div id="result"></div>

    enter line breaks to change document height
    <div id="element>"
    <br/><br/><br/><br/><br/>
    <br/><br/><br/><br/><br/>
    <br/><br/><br/><br/><br/>
   <br/><br/><br/><br/><br/>
     <br/><br/><br/><br/><br/>
     <div>

JavaScript

var refreshDocHeight = function(){
    var h = $(#element).height();
    $('#result').html("Document height: " + h);
};

window.setInterval(refreshDocHeight, 200);