title: Validate form before submitting to php
body: <p>Hello I'm implementing a login page everything is working fine from the PHP side but now I would implement one more function using jQuery: I would like to check if the fields of the login are empty and if not than print something on the page, otherwise continue with php, how to do that?</p>
  
  <p>Here is part of my HTML code:</p>
  
  <pre><code>&lt;form id="loginForm" action="login-exec.php" name="loginForm" method="post" class="ui-body ui-body-a ui-corner-all" data-ajax="false"&gt;
      &lt;fieldset&gt;
          &lt;div data-role="fieldcontain"&gt;
              &lt;label class="ui-input-text" for="login"&gt;Login:&lt;/label&gt;
              &lt;input name="login" type="text" class="textfield" id="login" /&gt;
          &lt;/div&gt;                                  
          &lt;div data-role="fieldcontain"&gt;                                      
              &lt;label class="ui-input-text" for="password"&gt;Password:&lt;/label&gt;
              &lt;input name="password" type="password" class="textfield" id="password"/&gt; 
          &lt;/div&gt;
          &lt;input type="submit" name="Submit" value="Login" /&gt;
      &lt;/fieldset&gt;
  &lt;/form&gt;     
  </code></pre>