Using the jQuery Validate plugin, I’ve got a group of 3 radio buttons, ‘foo’; if the user selects #foo0, then #fooDetail is not required, but if the user selects either #foo1 or #foo2, #fooDetail is required:
var $req = "required";
foo: $req,
fooDetail: {
required: function(element) {
return $("#foo1").is(":checked")||$("#foo2").is(":checked");
}
},
The problem is, if someone selects #foo1 or #foo2, changing the selection back to #foo0 doesn’t unset the error message on #fooDetail. I’ve also tried
return $("#foo0").not(":checked");
which doesn’t work either. Does anyone know how to deal with this?