如果选择选项等于某个选项,则跳过手风琴部分
我最近一直在研究一个相当复杂的手风琴/表单,并且在一个步骤中有一个选择下拉框,如果用户使用选择框选择了选项“是”,我希望它跳到最后一部分(7)。
我尝试使用下面的代码,但它似乎不起作用,它只是用空的空白替换了手风琴,就像它找不到它正在寻找的东西或正在引用未知的东西一样。
$('#perfect-condition').change(function() {
var name = this.value;
if(name == 'Yes')
{
if (v.form()) {
$("#stepForm").accordion("activate", 7);
current = 7;
}
}
});
编辑: 我正在制作一个基于 jquery 网站上的演示之一的手风琴,它是使用 jquery 验证的多部分表单,但这不是问题,手风琴使用 ul/li 结构,可以轻松地在面板之间移动,下面是我用作下一个按钮的代码:
$(".open3").click(function() {
if (v.form()) {
accordion.accordion("activate", 3);
current = 3;
}
});
我之前的代码应该在这个函数内吗?抱歉,我真的不是 jquery 专家...
如果有人可以阐明这一点并帮助我,我将非常非常感激:)
I have been working on quite a complex accordion/form recently and have a select dropdown box on one step, i want it to skip to the last section (7) if the user has chosen the option yes with the select box.
i tried to use the code below but it didn't seem to work, it just replaced the accordion with empty white space like it couldn't find what it was looking for or was referencing something unknown.
$('#perfect-condition').change(function() {
var name = this.value;
if(name == 'Yes')
{
if (v.form()) {
$("#stepForm").accordion("activate", 7);
current = 7;
}
}
});
EDIT:
i am making an accordion based on one of the demos on the jquery site, it is a multipart form using jquery validation, that isn't the issue though, the accordion is using a ul/li structure and can travel between the panels with ease, below is the code i am using as the next buttons:
$(".open3").click(function() {
if (v.form()) {
accordion.accordion("activate", 3);
current = 3;
}
});
should my previous code be inside of this function? sorry not a jquery expert really...
if anyone could shed some light on this and help me out i would be very very grateful :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
至少,您将选择列表的选定值拉错了。
但实际的手风琴更新调用似乎是合法的,假设
#stepForm
实际上是手风琴。如果仍然不起作用,请在原始帖子中添加更多代码和 HTML。At the very least, you're pulling the selected value of the select list wrong.
But the actual accordion update call seems legit, assuming that
#stepForm
is actually the accordion. If it still doesn't work, add more code and HTML to your original post.好吧,似乎现在可以工作了,对实际链接做了一些更改,如果您需要解决类似的问题,请参阅下面的代码...
Ok seems to have it working now, made some changes to the actual link, see code below if you need to fix a similar problem...