title: Preventing form from going to action page also prevents data from being submitted
body: <p>I created a form that submits its input to a database via a PHP page, and it works great, except for that I can't get the below script to work.</p>
  <p>The intention is to submit the form but without actually jumping to createaccount.php. However, when I use the jQuery script below it prevents the form data from being submitted at all.
  This code is from a project from a few years ago, and back then it worked fine. It seems it also works for everyone else on StackOverflow, so... confusing.</p>
  <p>If it helps, I'm using Chrome. And I also tried using e instead of event, and instead of preventDefault() I also tried stopPropagation() and stopImmediatePropagation(), but these have the same results. Any ideas would be appreciated. Thanks for your time!</p>
  <p><strong>HTML</strong></p>
  <pre><code>&lt;form action=&quot;createaccount.php&quot; method=&quot;post&quot; id=&quot;form&quot;&gt;
    Username:&lt;input type=&quot;text&quot; name=&quot;username&quot;&gt;
    Password:&lt;input type=&quot;password&quot; name=&quot;password&quot;&gt;
    Email:&lt;input type=&quot;email&quot; name=&quot;email&quot;&gt;
    &lt;input type=&quot;submit&quot; name=&quot;submit&quot; value=&quot;Submit&quot;&gt;
  &lt;/form&gt;
  </code></pre>
  <p><strong>JavaScript (jQuery)</strong></p>
  <pre><code>$(document).ready(function() {
    $(&quot;#form&quot;).on('submit', function(event){
       event.preventDefault();
    });
  })
  </code></pre>