jQuery.validate插件 多form验证

本身此插件不支持多form验证, 经过我的摸索, 其实像下面写依然可以实现多form, 也就是咱们手动给她规则



 1             $("#btnAddSubmit").click(function () {
2 $("form:first").validate().settings.rules = {
3 "txtAddSortId": { required: true, number: true },
4 "txtAddRightName": { required: true },
5 "txtAddRightElement": { required: true }
6 };
7 $("form:first").validate().settings.messages = {
8 "txtAddSortId": { required: "不能为空", number: "必须为数字" },
9 "txtAddRightName": { required: "不能为空" },
10 "txtAddRightElement": { required: "不能为空" }
11 };
12 });

你可能感兴趣的:(validate)