Well... I don't know JS that well, but I suppose you could just do this...
Seems like it could work out alright. Untested. Also... serves no real purpose. ...just makes a ton of divs.
newdiv = '<div>' + divcontent + '</div>';
divcontent = '<input type="button" onClick="this.innerText = this.innerText + divcontent2">';
EDIT: Well... since I don't know JS that well, I can't finish the code. I was testing it an realized I just messed up putting 'this' which would refer to the button, not the div. So.... this.parentdiv would be great, but I don't know what the right code is to select that. Perhaps someone else can suggest something.