Firebug is showing me the following:
From the followin Validator initialization:
$("#surveyForm").validate({
errorPlacement: function(error, element) {
if ( element.is(":radio") ) {
error.appendTo ( '#' + element.attr('name') + '_multiError' );
} else if ( element.is(":checkbox") ) {
error.appendTo ( '#' + element.attr('name') + '_multiError' );
} else {
error.appendTo( element.parent() );
}
},
rules: {
ans_23: {
depends: function(element) {
return $("#ans_22:checked")
}
}
},
debug: true
});
The rule is based on the second example under rules here.
The HTML being referenced looks like this
<td class='two_columns'>
<label>
<input type='radio' name='rad_22' id='ans_22' class='required' value='Yes' /> Other
</label>
<input type='text' name='ans_23' id='ans_23' value='' class='' />
</td>
Anyone know why the depends method would be undefined?
Footnote: I also tried doing this using the rule add method (see below). That form validated and threw no errors when validate() was called and ans_23 did not gain "required" class....
$("#surveyForm").rules("add", {
ans_23: {
required: "#ans_22:checked"
}
});