+ 3
How do i use "document.body.innerHTML" without removing the rest of the page?
I have a code like an rpg, and I want to write a variable onto the page with document.body.innerHTML but without removing the rest of the page.
3 ответов
+ 6
If you only want to change a particular part of the body content you may better wrap the content to be changed within a div having an Id, and you then change the div's content instead (using getElementById function), this way other parts of the document's body are not in risk for unintentional change, just an idea : )
+ 6
you can do what @Ipang said to make a different content by wrapping the content to be changed or @Don't Mess With Texas said to append a new content after the last content in the part
+ 3
Unfortunately I cannot test it now but I think += should work.