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

时间:2013-10-01 20:41:46

标签: javascript jquery

在验证引擎中,我试图将错误显示在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.");
});

目前正在努力显示存在错误,但我正在尝试查看是否有方法列出有错误的字段。

谢谢!

1 个答案:

答案 0 :(得分:0)

假设您使用的是this插件。

这应该适合你:

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.
相关问题