title: force form submit button click with jquery
body: <p>Trying to trigger the submit functionality from JQuery. what am I doing wrong? In theory, this should work. I've tried about 4 different ways though.</p>
  
  <p>I have tried </p>
  
  <pre><code>$('input#submit').trigger("click");
  
  $( form:first ).submit();
  
  $( form:first ).trigger("submit");
  
  $('form#databaseActionForm').submit();
  </code></pre>
  
  <p>NOTHNG HAS WORKED (YET)?!</p>
  
  <p>CODE:</p>
  
  <pre><code>&lt;html lang="en"&gt;
  &lt;head&gt;
      &lt;title&gt;Database Management&lt;/title&gt;
      &lt;meta http-equiv="Content-Type" content="text/html;charset=UTF-8" /&gt;
          &lt;script src="http://code.jquery.com/jquery-3.1.0.min.js" integrity="sha256-cCueBR6CsyA4/9szpPfrX3s49M9vUU5BgtiJj06wt/s=" crossorigin="anonymous"&gt;&lt;/script&gt;
          &lt;style&gt;
              table td { border: 1px solid black; }
              table td:first-child { text-align: left; }
          &lt;/style&gt;
      &lt;script&gt;
          &lt;!--
          $(document).ready(function() {
              $('#erase').click(function() {
                  if (confirm("Are you sure that you want to ERASE ALL DATA from the database?"))
                  {
                      $('#buttonTypePressed').val("erase");
                      $('input#submit').trigger("click"); &lt;!-- HERE --&gt;
                  }
              });
  
              $('#update').click(function() {
                  var appID = $('#updateAppID').val();
                  var field = $('#fieldName').val();
                  var value = $('#newValue').val();
  
                  if (appID == null || appID == "") {
                      alert("You must enter the ID number of the entry you wish to modify.");
                      $('#updateAppID').focus();
                  }
                  else if (field == null || field == "") {
                      alert("You must choose which field you wish to modify.");
                      $('#fieldName').focus();
                  }
                  else if (value == null || value == "") {
                      alert("You must choose the new value you wish to appear in the database.");
                      $('#newValue').focus();
                  }
                  else {
                      $('#buttonTypePressed').val("update");
                      $('input#submit').trigger("click"); &lt;!-- HERE --&gt;
                  }
              });
  
              $('#delete').click(function() {
                  var appID = $('#deleteAppID').val();
  
                  if (appID == null || appID == "") {
                      alert("You must enter the ID number of the entry you wish to delete.");
                      $('#deleteAppID').focus();
                  }
                  else {
                      $('#buttonTypePressed').val("delete");
                      $('input#submit').trigger("click"); &lt;!-- HERE --&gt;
                  }
              });
          });
          --&gt;
      &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;div id="container"&gt;
          &lt;from id="databaseActionForm" name="databaseActionForm" method="POST" action="&lt;?php echo htmlspecialchars($_SERVER['PHP_SELF']); ?&gt;"&gt;
              &lt;table border=0 style="margin: 50px auto; text-align: right;"&gt;
                  &lt;tr style="text-align: center; font-weight: bold; font-size: 1.5em; text-decoration: underline;"&gt;
                      &lt;th&gt;Action&lt;/th&gt;
                      &lt;th&gt;Additional Info&lt;/th&gt;
                      &lt;th&gt;Button&lt;/th&gt;
                  &lt;/tr&gt;
                  &lt;tr name="Clear"&gt;
                      &lt;td&gt;Erase Database&lt;/td&gt;
                      &lt;td style="text-align: center;"&gt;ARE YOU SURE?&lt;/td&gt;
                      &lt;td&gt;&lt;input type="button" id="erase" name="erase" value="ERASE ALL?" /&gt;&lt;/td&gt;
                  &lt;/tr&gt;
                  &lt;tr name="Update"&gt;
                      &lt;td&gt;Update Value&lt;/td&gt;
                      &lt;td&gt;
                          Entry ID: &lt;input type="text" id="updateAppID" name="updateAppID" placeholder="App entryID" /&gt;&lt;br /&gt;
                          Field Name: &lt;input type="text" id="fieldName" name="fieldName" placeholder="Field to change" /&gt;&lt;br /&gt;
                          New Value: &lt;input type="text" id="newValue" name="newValue" placeholder="New value" /&gt;&lt;br /&gt;
                      &lt;/td&gt;
                      &lt;td&gt;&lt;input type="button" id="update" name="update" value="Update Value" /&gt;&lt;/td&gt;
                  &lt;/tr&gt;
                  &lt;tr name="Delete"&gt;
                      &lt;td&gt;Delete Payment&lt;/td&gt;
                      &lt;td&gt;
                          Entry ID: &lt;input type="text" id="deleteAppID" name="deleteAppID" placeholder="App entryID" /&gt;
                      &lt;/td&gt;
                      &lt;td&gt;&lt;input type="button" id="delete" name="delete" value="Delete Entry" /&gt;&lt;/td&gt;
                  &lt;/tr&gt;
              &lt;/table&gt;
              &lt;input type="hidden" id="buttonTypePressed" name="buttonTypePressed" /&gt;
              &lt;input type="submit" id="submit" name="submit" value="submit" style="position: absolute; left: -9999px; width: 1px; height: 1px;" tabindex="-1"/&gt;
          &lt;/form&gt;
      &lt;/div&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p></p>