title: Hide form and display div on form submit
body: <p>I'm trying to hide the form in <code>div id="first"</code> and show the <code>div id="second"</code> when the submit button is pressed. Below is the code I'm using, but it isn't working. The result is a 'quick' hide of <code>div id="first"</code> and a 'quick' show of <code>div id="second"</code> before the page returns to its original view. </p>
  
  <p>Can someone please help me correct this? Thank you!</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>$(document).ready(function() {
    $("#myform").submit(function(e) {
      $("#first").hide();
      $("#second").show();
    });
  });</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"&gt;&lt;/script&gt;
  &lt;!doctype html&gt;
  
  &lt;div id="first" class="1" style="display:"&gt;
    &lt;form action="/student/webdesign/2015/4th/04_50/tinker/hideDiv/hide.php" method="post" id="myform"&gt;
      &lt;p&gt;
  
        &lt;label for="textfield"&gt;Text Field:&lt;/label&gt;
        &lt;input type="text" name="name" id="name"&gt;
        &lt;br&gt;
        &lt;input type=submit formmethod="POST"&gt;
      &lt;/p&gt;
    &lt;/form&gt;
  &lt;/div&gt;
  
  
  &lt;div id="second" class="2" style="display:none"&gt;
    test
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>