简体   繁体   English

jQuery验证器警报被触发多次,而仅在Firefox中按Enter

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

Jquery validator triggers alert multiple times in firefox when pressing enter key, 当按下Enter键时,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 小提琴

Try to clean up your html code, and do things simple. 尝试清理您的html代码,并使事情变得简单。

Use rules option to set up the required inputs. 使用规则选项设置所需的输入。

Visit the documentation of .validate(): http://jqueryvalidation.org/validate 请访问.validate()的文档: http : //jqueryvalidation.org/validate

Validate is oddly doing another processes for blur and keyup . 验证奇怪地在进行另一个blurkeyup You have to add those options to validate as false. 您必须添加这些选项以将其验证为false。

,
onfocusout:false,
onkeyup:false

UPDATED FIDDLE 更新场

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM