1<div id="d"> old content </div>
2
3<script>
4 // Element stored in a variable for easy access
5 var div = document.getElementById("div");
6
7 // Save the original content of the div
8 var old = div.innerHTML;
9
10 // Change the content of the div
11 div.innerHTML = "new content";
12
13 // Reset the original content of the div
14 div.innerHTML = old;
15</script>