Possible Duplicate:
javascript compare strings without being case sensitive.
I am having two fields. I need to check whether both the fields contain the same value. If the same value then a alert is raised.
I am using validation engine jQuery.
I have a written a function like:
function kkkk(field, rules,i,options){
var password=field.val();
var username = getValueUsingElementID('username');
if(password==username){
return options.allrules.NotEqual.alertText;
}
}
Example:
sss2@ and sss2@ // shows error message
sss2@ and SSS2@ // no error message is shown
Please can anyone help. Both the values are user input.
Use the
toLowerCase()function. That will convert your strings to all lower case characters, and the comparison will then return true whether or not there were differences in case originally: