I am trying to extend this and have added a notEqualToGroup for text boxes. Not sure where I am going wrong. I found this code online and trying to modify it.
"notEqualToGroup": {
"func": function (value, element, options) {
var elems = $(element).find(options[1]); // get all the elements passed here with the same class
var valueToCompare = value; // the value of the current element
var matchesFound = 0; // count
// loop each element and compare its value with the current value and increase the count every time we find one
jQuery.each(elems, function () {
thisVal = $(this).val();
if (thisVal == valueToCompare) {
matchesFound++;
return this.optional(element) || notEqual;
}
});
// count should be either 0 or 1 max
if (matchesFound <= 1) {
return false;
}
},
"alertText": "* Please enter a Unique Value."
},
I am trying to extend this and have added a notEqualToGroup for text boxes. Not sure where I am going wrong. I found this code online and trying to modify it.
"notEqualToGroup": { "func": function (value, element, options) { var elems = $(element).find(options[1]); // get all the elements passed here with the same class var valueToCompare = value; // the value of the current element var matchesFound = 0; // count