I'm trying to check if at least one of my inputs has a value. The code below is currently working to check if all inputs have a value, I need to just check if one in the array contains a value.
var returnValue = true;
var listOfInputs = [
$("#entry_bg"),
$("#entry_carbs"),
$("#entry_bolus"),
$("#entry_correction"),
$("#entry_food"),
$("#entry_notes")
];
listOfInputs.forEach(function(e) {
if (!e.val()) {
returnValue = false;
}
});
if (!returnValue) {
return false;
}
What can I do to achieve this? Any help would be great, thanks!