2
我正在使用jquery validation plugin。我只想在選中複選框時將5的minLength屬性設置爲字段。我理解的「依賴」,但我怎麼用5只有使用jquery驗證插件檢查複選框時纔將minLength設置爲字段
"txt-alt-zip": {
required: { // the zip is required if the alternate billing address is checked
depends: function (element) {
return $("#chk-alt-billing-address").attr("checked");
}
},
minlength: { // the zip is required if the alternate billing address is checked
depends: function (element) {
return $("#chk-alt-billing-address").attr("checked");
}
}
}