email validation checking in Javascript : <p>I want to varify if the entered string is in email format or not. I am bit confused. I tried to write below code but failed. Can ayone help me please.</p>

<pre><code>Javascript Code:
&lt;script&gt;
            function emailValidation(id)
            {
        var emailPattern =  var emailPattern = /^\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;
                if (emailPattern.test(id) === false)
                {
                    alert("not a valid email address.");
                 }            
                 document.getElementById(id).value = "";
            }
         &lt;/script&gt;

HTML Code:
             &lt;input type="text" id="empemail" onblur="emailValidation('empemail')" name="email" placeholder="eg: aaa@abc.ca" required=""&gt;
</code></pre>
