<form method="post" name="myForm">
<span class="formError email">Please Enter Valid Email</span>
<input type="text" name="Email" id="email" />
<input type="submit" value="Send" name="submitButton" />
</form>
.formError{ display:none; }
script 1
var email = $("#email").val();
if(email=='')
{
$('.email').fadeOut(200).show();
}
script 2
var x=document.forms["myForm"]["email"].value;
var atpos=x.indexOf("@");
var dotpos=x.lastIndexOf(".");
if (atpos<1 || dotpos<atpos+2 || dotpos+2>=x.length)
{
alert("Not a valid e-mail address");
return false;
}
How to combine script 1 and script 2 with,
if(email=='' || )
{
}