Manipulating innerHTML removes the event handler of a child element? [duplicate]

Yes, when you do:

document.body.innerHTML += '<br>'; 

You’re really doing:

document.body.innerHTML = (document.body.innerHTML + '<br>'); 

So you’re completely destroying and recreating all the content.

Leave a Comment