gpt4 book ai didi

javascript - jQuery 验证 showError block 突出显示

转载 作者:行者123 更新时间:2023-12-03 07:24:26 30 4
gpt4 key购买 nike

在我的网站上,我需要在表单中使用验证,但是表单有选项卡。运行时.validate()我要 highlight无效的输入并弹出一条摘要消息,说明您遇到问题并转到 X 选项卡来修复它。 showErrors似乎阻止了 highlight方法

弹出作品,highlight没有。删除showErrorhighlight作品

这是我的代码:

$("#frmMyForm").validate({
onclick: false,
onkeyup:false,
ignore: ":disabled",
rules: {

PasswordExpiryDays: { required: true, number: true, min: 30, max: 90 },
PasswordStrength: { required: true, number: true, min: 10, max: 50 }

},
messages: {

PasswordExpiryDays: {
required: " This can't be left blank",
min: "Please enter a number between 30 and 90",
max: "Please enter a number between 30 and 90"
},
PasswordStrength: {
required: " This can't be left blank",
min: "Please enter a number between 10 and 50",
max: "Please enter a number between 10 and 50"
}

},

showErrors: function (errorMap, errorList) {
//code for error message pop-up
}
});

最佳答案

好的,包括

this.defaultShowErrors();

showErrors 上修复了问题

关于javascript - jQuery 验证 showError block 突出显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36060880/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com