I have a page of input fields used for data entry. No input field should have duplicates.
If a user enters "ABC" into an input field and tabs out the function should detect whether "ABC" exists in any other input field. If the value exists then an error message is displayed after each of the input fields, including the current input field.
If the value is changed (eg to "DBE") in any of these input fields and therefore, there are no duplicates then all messages should hide.
I am currently stuck with the following:
$("input[type='text']").on("keyup change", function() {
var value = this.value;
if ($("input[type='text']:contains('" + value"')").length > 1)
{
$(this).find(".error").show();
}
else {
$(this).find(".error").hide();
}
}
});