当只在firefox中按enter键时,Jquery验证器警报会被多次触发

Jquery validator alert gets triggered multiple times while press enter only in firefox

本文关键字:验证 firefox 中按 enter Jquery 键时      更新时间:2023-09-26

Jquery验证器在按下回车键时在firefox中多次触发警报,

showErrors: function(errorMap, errorList) {
    var summary = "You have the following errors: 'n";
    $.each(errorList, function() {
        summary += " * " + this.message + "'n";
    });
    alert(summary);
    this.defaultShowErrors();
}

FIDDLE

试着清理你的html代码,做一些简单的事情。

使用规则选项设置所需的输入。

请访问.validate()的文档:http://jqueryvalidation.org/validate

Validate奇怪地为blurkeyup执行另一个进程。您必须添加这些选项才能验证为false。

,
onfocusout:false,
onkeyup:false

更新的FIDDLE