title: JQuery function submit() not submitting form
body: <p>I can't get the form to submit, the <code>alert ($('#submit').val());</code> in the <code>else</code> with the submit comes up so the code is getting into the right place, but the form is not submitting.</p>
  
  <p>Form has an id of othernames, submit button was called name and id of save at one point, currently both are set to submit.</p>
  
  <p>any help appreciated.</p>
  
  <pre><code>$(document).ready(function(){
  // force content into cnamex
  $('#submit').click(function(event){
      event.preventDefault(); // prevent submit
      error = '';
      for ( var i = 0; i &lt; 10; i++ ) {
          if  ($('#cname' + i).length &gt; 0) {
              if ($('#cname' + i).val().length == 0) {
                  error = 'Names for those attending are required';
              }
          }
      }
      if (error != '') {
          alert (error);
      }
      else {
          $('#othernames').submit();  
          alert ($('#submit').val());
      }
  });
  }); 
  </code></pre>
  
  <p>HTML is PHP generated, this is a version of it without any boxes to validate</p>
  
  <pre><code>&lt;form enctype="multipart/form-data" name="othernames" id="othernames"  method="post"    action="" target="_self"&gt;
  &lt;div class="table"&gt;
  &lt;table width="100%" border="0"&gt;
  &lt;tr&gt;
          &lt;td colspan="3" &gt;&lt;input name="submit" id="submit" type="submit" value="Confirm  Order" &gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;/table&gt;
  &lt;/div&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>This is with fields to validate:-</p>
  
  <pre><code>&lt;form enctype="multipart/form-data" name="othernames" id="othernames"  method="post" action="" target="_self"&gt;
  &lt;div class="table"&gt;
  &lt;table width="100%" border="0"&gt;&lt;caption&gt;Enter names for tickets, (if any)&lt;/caption&gt;
    &lt;tr&gt;
      &lt;th scope="col"&gt;Name&lt;/th&gt;
      &lt;th scope="col"&gt;Email (Optional)&lt;/th&gt;
      &lt;th scope="col"&gt;Club&lt;/th&gt;
    &lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;input name="cID[]" type="hidden" value="11"&gt;&lt;input name="cname[]" id      ="cname0" type="text" size="15" maxlength="20"&gt;&lt;/td&gt;
              &lt;td&gt;&lt;input name="cemail[]" id="cemail0" type="text" size="15"     maxlength="60"&gt;&lt;/td&gt;&lt;td&gt;&lt;input name="cclub[]" type="text" size="15" maxlength="25"    value="VRA - United Kingdom"&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;input name="cID[]" type="hidden"    value="11"&gt;&lt;input name="cname[]" id="cname1" type="text" size="15" maxlength="20"&gt;&lt;/td&gt;
          &lt;td&gt;&lt;input name="cemail[]" id="cemail1" type="text" size="15" maxlength="60"&gt;&lt;/td&gt;&lt;td&gt;&lt;input name="cclub[]" type="text" size="15" maxlength="25"  value="VRA - United Kingdom"&gt;&lt;/td&gt;&lt;/tr&gt;
  &lt;tr&gt;
  &lt;td colspan="3" &gt;&lt;input name="submit" id="submit" type="submit" value="Confirm  Order" &gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;/table&gt;
  &lt;/div&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>Problem Solved using  reyaner's suggestion, thank you. JQuery now reads, and html uses a submit button </p>
  
  <pre><code>$(document).ready(function(){
  // force content into cnamex
      $('#submit').click(function(event){
              error = '';
          for ( var i = 0; i &lt; 10; i++ ) {
              if  ($('#cname' + i).length &gt; 0) {
                  if ($('#cname' + i).val().length == 0) {
                  event.preventDefault(); // prevent submit
                  error = 'Names for those attending are required';
                  }
              }
          }
          if (error != '') {
              alert (error);
          }
      });
  });
  
  
  
  enter code here
  </code></pre>