title: Jquery script not working for form submit
body: <p>Form submit function is not working when written in an external jquery file, but works on the browser console. I have tried to debug a lot but couldn't find any error. Similar form submit functions written in the same jquery file work well but no idea why this one doesn't work.</p>
  <p>Other such queries on stack overflow indicate that there shouldn't be any other element in the file with classname <code>submit</code> but I've checked everything and it's not this case. Would really appreciate any help.</p>
  <pre><code>&lt;%- include('partials/header.ejs') %&gt;
  
  &lt;form id=&quot;customStocksForm&quot;&gt;
      &lt;div class=&quot;form-group&quot;&gt;
          &lt;label for=&quot;inputMoney&quot;&gt;Enter some money&lt;/label&gt;
          &lt;input type=&quot;number&quot; name=&quot;money&quot; class=&quot;form-control&quot; id=&quot;inputMoney&quot; aria-describedby=&quot;moneyHelp&quot; min=&quot;1000&quot; value=&quot;1000&quot;&gt;&lt;/input&gt;
          &lt;small id=&quot;moneyHelp&quot; class=&quot;form-text text-muted&quot;&gt;Minimum amount is 1000 INR&lt;/small&gt;
      &lt;/div&gt;
      &lt;div class=&quot;container&quot;&gt;
          &lt;% data.map((asset, id) =&gt; { %&gt;
              &lt;% if(id%4 === 0) { %&gt;
                  &lt;/div&gt;
                  &lt;div class=&quot;row bg-dark text-light&quot;&gt;
              &lt;% } %&gt;
                  &lt;div class=&quot;col m-4&quot;&gt;
                      &lt;div class=&quot;form-check&quot;&gt;
                          &lt;input type=&quot;checkbox&quot; name=&quot;stocks&quot; value=&quot;&lt;%= asset %&gt;&quot; class=&quot;form-check-input&quot; id=&quot;exampleCheck&lt;%= id %&gt;&quot;&gt;
                          &lt;label class=&quot;form-check-label&quot; for=&quot;exampleCheck&lt;%= id %&gt;&quot;&gt;&lt;%= asset %&gt;&lt;/label&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
          &lt;% }) %&gt;
      &lt;/div&gt;
      &lt;div class=&quot;text-center&quot;&gt;
          &lt;button class=&quot;btn btn-info btn-lg justify-content-center my-5 px-4&quot;&gt;Submit&lt;/button&gt;
      &lt;/div&gt;
  &lt;/form&gt;
  
  &lt;%- include('partials/footer.ejs') %&gt;
  </code></pre>
  <p>This is the footer.ejs</p>
  <pre><code>    &lt;/div&gt;
      &lt;script src=&quot;https://code.jquery.com/jquery-3.3.1.slim.min.js&quot; integrity=&quot;sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo&quot; crossorigin=&quot;anonymous&quot;&gt;&lt;/script&gt;
      &lt;script src=&quot;https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js&quot; integrity=&quot;sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1&quot; crossorigin=&quot;anonymous&quot;&gt;&lt;/script&gt;
      &lt;script src=&quot;https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js&quot; integrity=&quot;sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM&quot; crossorigin=&quot;anonymous&quot;&gt;&lt;/script&gt;
      &lt;script src=&quot;script.js&quot;&gt;&lt;/script&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  <p>The script.js file</p>
  <pre><code>$(document).ready(function() {
  
      // some other form submit functions which work fine
  
      $('#customStocksForm').submit(function(e) {
          e.preventDefault();
          console.log('Submitted');
      )};
  )};
  </code></pre>