title: How can I submit a form using JavaScript?
body: <p>I have a form with id <code>theForm</code> which has the following div with a submit button inside:</p>
  <pre class="lang-html prettyprint-override"><code>&lt;div id=&quot;placeOrder&quot;
       style=&quot;text-align: right; width: 100%; background-color: white;&quot;&gt;
      &lt;button type=&quot;submit&quot;
              class='input_submit'
              style=&quot;margin-right: 15px;&quot;
              onClick=&quot;placeOrder()&quot;&gt;Place Order
      &lt;/button&gt;
  &lt;/div&gt;
  </code></pre>
  <p>When clicked, the function <code>placeOrder()</code> is called. The function changes the innerHTML of the above div to be &quot;processing ...&quot; (so the submit button is now gone).</p>
  <p>The above code works, but now the problem is that I can't get the form to submit! I've tried putting this in the <code>placeOrder()</code> function:</p>
  <pre class="lang-js prettyprint-override"><code>document.theForm.submit();
  </code></pre>
  <p>But that doesn't work.</p>
  <p>How can I get the form to submit?</p>