gpt4 book ai didi

php - Jquery表单验证: Display all errors in a specific section of the webpage

转载 作者:行者123 更新时间:2023-12-01 07:26:40 26 4
gpt4 key购买 nike

我正在使用 JQuery 的验证插件来验证 HTML 表单。 http://docs.jquery.com/Plugins/Validation

默认情况下,所有验证错误都位于输入旁边。是否可以在页面顶部显示所有错误的列表,以及我使用什么代码来执行此操作?

最佳答案

根据您可以为此插件提供的选项(请参阅 http://docs.jquery.com/Plugins/Validation/validate#options ),您可以指定 errorLabelContainererrorContainer 选项,它将在其中对错误消息进行分组放入单个或多个容器中。

从网站获取的样本:

<ul id="messageBox"></ul>

 

$("#myform").validate({
errorLabelContainer: "#messageBox",
wrapper: "li",
submitHandler: function() { alert("Submitted!") }
})

关于php - Jquery表单验证: Display all errors in a specific section of the webpage,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9111757/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com