Post and get data from form using localstorage
<p>I have a simple form and div</p>

<pre><code>&lt;form action="" method="post"&gt;
  &lt;input name="username"&gt;
  &lt;textarea name="msg" rows="10"&gt;&lt;/textarea&gt;
  &lt;input type="submit" name="ok" value="Send" &gt;
&lt;/form&gt;
&lt;div id="comments"&gt;&lt;/div&gt;
</code></pre>

<p>How to create get and post data from form to div using localstorage?</p>

<p>And data also must stay there after the user refresh the page by checking localstorage.</p>

<p>It's something like local posted comment on the client side.</p>