我正在开发一个多步骤表单向导(Bootstrap 3.3.7),一切运行正常,但我尝试将其设置在页面底部的第2步单选按钮:( page,Own,up )。当我点击say OWNER时,它应该会跳过租户步骤,直接带我到OWNER步骤,同样的步骤也适用于无遮挡。我试过了,但一无所获。现在,使用这个javascript,它确实会进入所需的步骤,并将其显示在底部,而不是像我单击next时那样显示为真正的步骤。任何帮助都将不胜感激。这是我的JSFiddle代码:在https://jsfiddle.net/alachgar/43wgLvxr/2/处输入代码
<script>
$(document).on("click",".step-3",function(){
current_step = $(this).closest("fieldset");
next_step = $("#step-3");
next_step.show();
current_step.hide();
//setProgressBar(--current);
});
$(document).on("click",".step-4",function(){
current_step = $(this).closest("fieldset");
next_step = $("#step-4");
next_step.show();
current_step.hide();
//setProgressBar(--current);
});
$(document).on("click",".step-5",function(){
current_step = $(this).closest("fieldset");
next_step = $("#step-5");
next_step.show();
current_step.hide();
//setProgressBar(--current);
});
</script>发布于 2020-04-21 03:32:39
在javascript中的链接代码中,查看第101行:
if (isValid) nextStepWizard.removeAttr('disabled').trigger('click');您是按顺序执行的,所以无论我选择哪种方式,它都会启动下一步。应该有类似于(伪代码)的东西:
if (isValid && nextStep=="rent") nextStep("rent").removeAttr('disabled').trigger('click');
if (isValid && nextStep=="owner") nextStep("owner").removeAttr('disabled').trigger('click');以此类推--因此您可能需要重新设计此功能
nextStepWizard = $('div.setup-panel div a[href="#' + curStepBtn + '"]').parent().next().children("a"),所以要创建一个函数,它也允许正确的向后移动(如果合适的话)
https://stackoverflow.com/questions/61329290
复制相似问题