0
我正在使用jQuery验证插件,无法让它验证依赖于另一个字段。下面的相同逻辑将验证正常选择,但不是多选。这是我的jFiddle:herejQuery验证多个选择依赖于另一个字段
在小提琴中,我使用的是正常选择,但是当我将其更改为多选时,它会中断。寻找解决方案。谢谢。
的jQuery:
$("#my_form").validate({
rules: {
'my_choice_name': {
required: {
depends: function (element) {
//this logic works (tested on another field name/value), just not on the multiple select field:
if ($('#my_alt_select_id').val() !== '3') {
return true;
} else {
return false;
}
}
}
}
}
});
太棒了。按预期工作。谢谢! – Patrick