If you call it directly while a document is loaded, it'll work, but here you call it after the page has fully loaded, and in that case it will simply replace the document content.
The proper way is to use .innerHTML:
and
document.querySelector( "#container").innerHTML = "
Ok, so I am trying to update a table with elements from an xml doc. The user selects a table to load from a selection box and the current table is removed and a new one is opened. I have not found a way to do this properly yet. Currently, my code will update the contents of the table when the user makes a selection, but everything outside of the table disappears; including the style properties. Why is that? Can anyone take a look at my code and figure out what's wrong