I have this script:
var value = jQuery(this).attr("value");
var value2 = jQuery(".my_form #value2 ").attr("value");
if(value != value2){
var errorcode = "error -" + value + "-";
surrounding_element.attr("class","").addClass(errorcode);
var errorcode = "error -" + value2 + "-";
jQuery(".my_form #value2 ").parent().attr("class","").addClass(errorcode);
}else{
surrounding_element.attr("class","").addClass("valid");
jQuery(".my_form #value2 ").parent().attr("class","").addClass("valid");
} }
If I put exactly the same value in both fields, for example info@thisisafakeemail.fake (I’m testing email addresses), then the result is:
class="error -info@thisisafakeemail.fake-"
for both elements.
So it seems to me that value and value2 are identical. But the ‘if’ says no.
Why? :goof: