Handle DOM node inserted event action - Javascript DOM

Javascript examples for DOM:Element addEventListener

Description

Handle DOM node inserted event action

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  ww  w.ja va2s . 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