I have a form with two fields; mobile number. and phone number.
At least 1 field must be filled, but both of them can also be filled.
I need a jquery check to throw an error if none of them are filled only.
I have achieved this:
rules: { mobile:{ required: { depends: function(element) { return $("#regTelephone").val() === ''; } } }, telephone:{ required: { depends: function(element) { return $("#regMobile").val() === ''; } } } }
however, if only one field is empty, that field still gets the "valid" class, which I don't want, since my valid css has a green border (so the empty field still gets a green border)
like this: how can I get an empty field (if another matters) so as not to get a valid class and therefore a green border?
source share