title: Validate HTML form fields if it is specified with required attribute
body: <p>I created a JSP page and I have many forms each in different tabs. So I have added a single submit button common to all forms(So the button is outside of the &lt;<strong>form</strong>> tag). On each tab, when the submit is clicked, the appropriate forms are being submitted using JQuery. In all forms some form fields are required. And I have specified those fields with the required attribute like the following</p>
  
  <pre><code>&lt;div class="control-group"&gt;
          &lt;label class="control-label input-label" for="hostname"&gt;Host :
                      &lt;span class="requiredField"&gt; * &lt;/span&gt;
              &lt;/label&gt;
          &lt;div class="controls"&gt;
              &lt;input type="text" class="inputstyle" name="hostname" placeholder="host" required="required" /&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>The problem is when I click on submit button, it does not validate fields which are required. If the submit button is inside the form, it's working. But I need common submit button. How to solve this?</p>
  
  <p>I am just thinking in JQuery I am submitting form with form action value. So before submitting is it possible to call function to validate form by passing form ID and evaluate the required fields? If so, please help me to code.</p>
  
  <p>Thanks</p>
  
  <p><strong>UPDATE 1</strong></p>
  
  <pre><code>&lt;button type="submit" id="submitbtn" class="btn btn-primary inputstyle" onclick="submitForm();"&gt;SUBMIT&lt;/button&gt;
  </code></pre>
  
  <p>JQuery for this</p>
  
  <pre><code>function submitForm() {
              var $submitform=$('#formId').val();
  
              //validateForm($submitform); // I have not created this function.
              $('#'+$submitform).submit();
      }
  </code></pre>