Get to know when an Html Element is ready and rendered - Javascript DOM

Javascript examples for DOM:Element clientHeight

Description

Get to know when an Html Element is ready and rendered

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript">
    window.onload=function(){//from   w ww . j  a v a  2s  . co m
document.body.addEventListener('DOMNodeInserted', function(e) {
    console.log('div height=' + e.target.clientHeight)
});
d = document.createElement("div");
d.appendChild(document.createTextNode("hello"));
t = document.body.appendChild(d);
    }

      </script> 
   </head> 
   <body>  
   </body>
</html>

Related Tutorials