1.3 Killed my Email Validation Function
I've been fighting with this all day. It works in 1.2.6 but not in 1.3.2. It's a function that I can call to check an input to make sure the email is valid and is not from hotmail or gmail or whatever. I can call it when the input is blurred or when the form is submitted. The form will not submit if a .error is visible.
I have no idea what part of this code is depreciated..
-
jQuery.fn.form_realemail = function () {
return this.each(function (){
if ($(this).val() != "") {
error2 = 0;
if ($(this).is("[value$='hotmail.com']")) { error2 = 1; }
if ($(this).is("[value$='gmail.com']")) { error2 = 1; }
if ($(this).is("[value$='yahoo.com']")) { error2 = 1; }
if ($(this).is("[value$='msn.com']")) { error2 = 1; }
if ($(this).is("[value*='@']")) { } else { error2 = 2; }
if ($(this).is("[value*='.']")) { } else { error2 = 2; }
if (error2 == "0") { $(this).parent().find('.error').hide(); }
if (error2 == "1") { $(this).parent().find('.error').show().text("Company Emails Only."); }
if (error2 == "2") { $(this).parent().find('.error').show().text("Enter A Valid Email Address."); }
} else { $(this).parent().find('.error').show().text("Email Address is Required."); }
});
}