Validate form using jQuery
<p>When a form submit button is clicked, a function to validate all the field is to be called. Nothing is to happen, however, if the validation fails.</p>

<p>I am using <code>mailto:</code> as my action, does this make a difference?<br>
I would like to get clarification on two things:</p>

<ol>
<li><p>Is this the correct way to call a function when clicking the submit button?</p>

<pre><code>$(document).ready(function(){
    $('#contactForm').submit(function(){
        checkMail();
    });
});
</code></pre></li>
<li><p>Can I still validate the fields even though I'm using <code>mailto:</code>?</p></li>
</ol>

<p>Here is the rest of the code:</p>

<pre><code>function checkEmail(){
    var email = document.contact.email.value;

    if(email == "") {
        document.getElemtById("email_error").innerHTML = "No Email Address";
        return false;
    }
    else {
        document.getElementById("email_error").innerHTML = ""
        return true;
    }
}
</code></pre>

<p>HTML:</p>

<pre><code>&lt;form name="contact" action="mailto:exampleemail@hotmail.com" method="post"&gt;
    &lt;li&gt;
        &lt;label for="email"&gt;Email&lt;/label&gt;
    &lt;input id="email" type="text" name="email" placeholder="Enter Email Address"&gt;
    &lt;/li&gt;
    &lt;span id="email_error"&gt;&lt;/span&gt;
</code></pre>

<p>Further, I don't get an error message on clicking submit.</p>
