Javascript examples for DOM:Event
DOM Mutation event in vanilla Javascript
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> window.onload=function(){/* ww w .j av a 2 s . co m*/ var container = document.getElementById('container'); container.addEventListener('DOMNodeInserted', function () { console.log('A node was inserted into #container'); }); var div = document.createElement('div'); div.innerHTML = 'I\'m a div!'; container.appendChild(div); } </script> </head> <body> <div id="container"></div> </body> </html>