title: jQuery .submit() with validation and without page refresh
body: <p>I have a problem that others seem to have, but I cannot get the recommended solution (i.e., "return false;") to work.  Any help would be great!</p>
  
  <p><strong>Description:</strong></p>
  
  <p>When the form is submitted, I want to validate the input is in the correct format (i.e., type="email") and launch an alert (i.e., "Form submitted.") <em>without</em> the page refreshing.  Currently, the alert does not appear and the page refreshes.</p>
  
  <p><strong>Test Code:</strong></p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  
  &lt;html lang="en"&gt;
      &lt;head&gt;
          &lt;!-- JavaScript --&gt;
          &lt;script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"&gt;&lt;/script&gt;
      &lt;/head&gt;
  
      &lt;body&gt;
          &lt;!-- Form --&gt;
          &lt;form&gt;
              &lt;input type="email" placeholder="Email" value="" size="25px" required="required" id="userEmail"&gt;
              &lt;button type="submit" id="submit"&gt;Submit&lt;/button&gt;
          &lt;/form&gt;
  
          &lt;!-- Alert on Submission --&gt;
          &lt;script&gt;
              console.log("Ready to Go!");
              $('#submit').submit(function () {
                  alert("Form submitted.");
                  return false;
              });
          &lt;/script&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>