I have 3 input fields that ask for the number of people, and of them how many are adults and how many are children. I am trying to use jQuery validate plugin to add a custom method where children + adults = number of people
This is my validation call
$("#form2").validate({
errorElement: "span",
rules: {
attendees: {
required: true,
digits: true
},
adults: {
required: true,
digits: true
},
children: {
required: true,
digits: true
}
},
messages: {
attendees: "Enter the number of persons (including yourself)",
adults: "Enter number of adults",
children: "Enter number of childern"
}
});
I looked at the group feature and .addMethod()
method of the validate plugin but it seems that it was crafted only with one element in mind. Any ideas?