Does Javascript provide an event listener similar to onload that will be invoked if an element is added to the DOM via innerHTML
?
I know <body onload="alert('hi');">...</body>
. But it does only work in the beginning when the whole site is loaded.. Is it somehow possible to add an element via innerHTML = ...
that triggers an event listener instantly that it contains?
It should look like this and it has to be an inline-HTML listener like this:
elementxy.innerHTML = '<b onload="dosth()">....</b>'