You could do like below:
if ($("#reference,#pin,#fName,#mName,#datepicker").filter(function() { return $(this).val(); }).length > 0) {
//..
}
Using a common function like the following would make it reusable:
function hasValue(elem) {
return $(elem).filter(function() { return $(this).val(); }).length > 0;
}
And you could call it like this:
hasValue("#my-input-id");
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…