Jquery validate depend field

Huy Guys,

I am trying to use jQuery validation plugin and specify that one field is required only when 3 other fields are blank (not filled).

the thing is that the rule is working but it still remain requiring the field even when I type value on it.

Thanks.

This is my code:

$("#ProspectDtlFrm").validate({
 rules: {

  prsptEmail: {
   required: function(element) { return ( $("#prsptHomePhone").val() == '' && $("#prsptBusinessPhone").val() == '' && $("#prsptMobilePhone").val() =='') }                                         
   }    
 },
 messages: {
      prsptEmail: "Please enter your first name"
 }
}); 
19
задан MNR 20 May 2015 в 11:30
поделиться