Adding dependent validations using jQuery Validate
While validating one of the many forms, I came accross a situation where a form field’s presence was dependent on another DOM element, depends
property of jquery-validate
plugin came to resue.
In the above example, contact
is always required, but email
and number
are dependent on a radio being checked for contact via email and mobile number respectively.
References: .validate() method