I've put together a little javascript file which uses a clean framework, here's how it's formatted:
var functionLibrary = {
validateFields:function(inputArray, result) {
$.each(inputArray, function(index, listItem) {
if (!$.trim($("#" + listItem).val()).length) {
return "empty";
}
});
}
}
Here's me passing data to such function and getting an undefined
when validating the response:
var Validation = functionLibrary.validateFields(['amount', 'ppemail']);
console.log(Validation);
Why does such function show undefined
in the console log when it should be returning empty
?