I have 2 external js files and I need a function to be called in html when document.body.innerHTML
adds an element. There is a function in the other file that I want to get called when this div is added. How would I call the function when the element is created?
//pseudo code
//first file:
document.body.innerHTML += "<div></div>"
//second file:
var foo = function() {
alert("foo");
}
//when div is added call foo.