title: How in javascript to make a form disappear on submission
body: <p>I have a form at the top of my html page which I want to have disappear after I submit the form.  My code (below), while it temporarily hides the form, insists on the forming then becoming visible again.  Any help would be appreciated.</p>
  
  <p>Thanks,</p>
  
  <p>Owen Walker</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;body&gt;
  
  &lt;form id="form" onsubmit="myFunction()"&gt;
    Enter name: &lt;input type="text" name="fname"&gt;
    &lt;input type="submit" value="Submit"&gt;
  &lt;/form&gt;
  
  &lt;div id="first_div" style="visibility:hidden"&gt;Second&lt;/div&gt;
  
  &lt;script&gt;
  function myFunction() {
      alert("The form was submitted");
      document.getElementById("form" ).style.display = "none";  
      document.getElementById("first_div" ).style.visibility = "visible";
  alert("after"); 
  }
  &lt;/script&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>