簡體   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