繁体   English   中英

jQuery验证引擎在警报中显示错误

[英]Jquery Validation Engine displaying errors in alert

在验证引擎中,我试图让错误显示在javascript警报框中,而不是在错误旁边的小工具提示中显示。

$("#main_form").bind("jqv.form.result", function(event, errorFound) {
    if(errorFound)
        alert("There is a problem with your form.\n\nPlease fill out all of the required fields.");
});

当前,这正在显示错误,但是我正在尝试查看是否有一种方法可以列出有错误的字段。

谢谢!

假设您正在使用插件。

这应该为您解决问题:

var errors = []; // initialize the error array

$('.formError').next().each(function(){ 
   errors.push($(this).attr('id'));
});

console.log(errors); //Should give you an array of elements with errors.

暂无
暂无

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

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