如何以多部分表单进入下一步(验证后)
我在 UI Accordion 上使用 jQuery 验证插件。我想在验证运行没有错误后打开下一个手风琴。我知道这是一个非常基本的功能,但我不知道如何做到这一点。有什么建议吗?
$(document).ready(function(){
$("#applicant-form").validate({
errorPlacement: function(error,element) {
return true;
},
rules: {
"firstName": {
required: true,
minlength: 2
}
},
});
$(".next-step").click(function(e){
e.preventDefault();
var acc = $("#accordion"),
index = acc.accordion('option','active'),
total = acc.children('div').length,
nxt = index + 1;
acc.accordion('activate', nxt);
});
I am using the jQuery Validation plugin on the UI Accordion. I would like to open the next accordion after the validation is run without errors. I know this is a very basic function, but I can't figure out how to do it. Any suggestions?
$(document).ready(function(){
$("#applicant-form").validate({
errorPlacement: function(error,element) {
return true;
},
rules: {
"firstName": {
required: true,
minlength: 2
}
},
});
$(".next-step").click(function(e){
e.preventDefault();
var acc = $("#accordion"),
index = acc.accordion('option','active'),
total = acc.children('div').length,
nxt = index + 1;
acc.accordion('activate', nxt);
});
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以制作单独的表单,并使用验证中的
submitHandler
选项来切换 Accordion。You can do separate forms, and use the
submitHandler
option in the Validation to switch the Accordion.