Может так
<!DOCTYPE HTML>
<html>
<head><meta charset="utf-8"></head>
<body>
<script>
document.body.addEventListener("DOMSubtreeModified", function(e){
alert('Add dinamic element');
console.dir(e)
}, false);
function buildElement(tagName, props) {
var element = document.createElement(tagName);
for (var propName in props) element[propName] = props[propName];
return element;
}
document.body.appendChild(buildElement('input', {value: 'Test'}));
</script>
</body>
</html>
|