Non-restrictive email validation Just looking to do some super-duper basic email validation and was wondering if my code is efficient.

IE8 compatibility is a requirement.

/**
 * Email validation is futile
 * Make sure the @ symbol is not the first or last character
 */
jQuery.validator.addMethod("easyEmail", function(value, element, param) {
    value = $.trim(value);
    return this.optional(element) || (value.indexOf('@') &gt; 0 &amp;&amp; value.charAt((value.length-1)) !== '@');
}, "Please enter a valid email address.");


I am trying not to step on any toes since the RFC is mind-bogglingly complicated.
Your code would be slightly nicer this way:

jQuery.validator.addMethod("easyEmail", function(value, element, param) {
    if (this.optional(element)) {
        return true;
    }
    var trimmed = $.trim(value);
    var index = trimmed.indexOf('@');
    return index &gt; 0 &amp;&amp; index &lt; trimmed.length - 1;
}, "Please enter a valid email address.");


Slightly nicer, because:


Check element before trimming value, as you might not use value at all.
It's a good practice to not overwrite parameter variables
It's good to cache the result of .indexOf to avoid calling twice


That said, since @user45891 found that nice link for you, I recommend you use it. I understand you only want a super-simple email validation, but this is waaaay too simple, to the point of almost uselessness.