You're probably using
document.getElementById('element').innerHTML = "New content"
Try this instead:
document.getElementById('element').innerHTML += "New content"
Or, preferably, use DOM Manipulation:
document.getElementById('element').appendChild(document.createElement("div"))
Dom manipulation would be preferred compared to using innerHTML
, because innerHTML
simply dumps a string into the document. The browser will have to reparse the entire document to get it's stucture.