It's because innerHTML change whole content of the div.
<div id="whatever">
edit button
</div>
and you change html of whatever, you will rewrite the edit button.
Try this
<div id="container">
<div id="whatever"></div>
Edit button
</div>
So you'll change only the div whatever and edit button will stay.
I hope I did understand what you need.