How to retain textbox value after click submit button
<p>I have a search text box after click in submit button textbox value is retain, but when i reload the page the textbox value still in a text box, how do i remove the value of text box after reloading/refreshing the page.</p>

<pre><code>&lt;script&gt;
    $(document).ready(function(){
    document.getElementById("text1").value = localStorage.getItem("item1");
        });

   $(window).on('beforeunload', function() {
    localStorage.setItem("item1",document.getElementById("text1").value);
  });
&lt;/script&gt;
</code></pre>

<p>Html.</p>

<pre><code>&lt;td&gt;
&lt;form action="/searchemp" method="post" &gt;
    Selected Employee &lt;input type="text"  name="EmployeeName" id="text1"&gt;
                     &lt;input type ="submit" value="check"&gt;
&lt;/form&gt; 
</code></pre>

<p></p>

<p>Give me a help or suggestion to fix it.</p>

<p>Thank you.  </p>