how to save DOM insertions?

I want to know how to save a previous DOM insertion of my HTML page. Code:

//With jQuery
$('#container').append('Hi!');

And the window wil display Hi!, but I want to know how I could save that insertion to,when I refresh the page, display me 2 Hi!, being result of the previous insertion of the jQuery Mark.

How I can save the changes in the HTML structure that javascript do after executing the code(like the example below)?

You can save your status in many different ways.

  1. Save in server (database or session whatever through AJAX)
  2. Save in Cookies (You can save your data locally by accessing cookies in JavaScript)
  3. Save in LocalStorage (This is part of HTML5, which means this does not work in non-modern browsers)