function validInfoForm(){
return $("#form_password").validate({
ignore : "",//验证隐藏域,解决切换标签后隐藏域无法验证问题
rules: {
oldPassword: {
required: !0
},
newPassword: {
required: !0,
isPwd : true,
notEqualTo: $("#oldPassword")
},
surePassword:{
required: !0,
equalTo: $("#newPassword")
}
},
messages : {
oldPassword : {
required : e + "原密码不能为空"
},
newPassword : {
required : e + "新密码不能为空"
},
surePassword : {
required : e + "确认密码不能为空",
equalTo: e + "新密码和确认密码不一致"
}
},
errorPlacement: function (error, element) {//修改提示位置
if(element.is("input[name='newPassword']")){
error.appendTo($(".col-xs-12-padding"));
}else{
error.insertAfter(element);
}
},
showErrors: function(errorMap,errorList){
var i = 0;
for(var key in errorMap){
if(i == 0){
var contents = $("div.tab-content > div");//所有tab页的内容域
var tabs = $("div.tabbable ul li");//所有tab头
var index = contents.index(contents.has("[name='"+key+"']"));
tabs.eq(index).children("a:eq(0)")[0].click();//点击li下面的a标签
}
i++;
}
this.defaultShowErrors();
}
});
};
来源:CSDN
作者:摆渡睿
链接:https://blog.csdn.net/qq_36134977/article/details/103977761