I'm using the following code to make sure fields are filled in. How can I add some code to make sure it's a valid email?
function verify() {
if ($("#ddlBusinessName").val() == "0") {
alert("Please select the name.");
}
else if ($("#txtEmail").val().length <= 0 || $("#txtEmailConfirm").val().length <= 0) {
alert("Please enter the email address and confirm the email address.");
else if ($("#TxtPassword").val().length <=0 || $("#TxtConfirmPassword").val().length <=0) {
alert("Please enter your password.");
}
}
EDIT How can I implement this into my code though?
function validateEmail(email) {
var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\
".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA
-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
return re.test(email);
}