【发布时间】:2017-07-13 21:56:45
【问题描述】:
这是我的 JS 代码,我想使用 javascript 来制作我的wizard 下一步但我不知道我应该写什么代码。
$("#wizard").steps({
headerTag: "h3",
bodyTag: "section",
transitionEffect: "slideLeft",
autoFocus: true,
onStepChanging: function(e, currentIndex, newIndex){
// use ajax to check if something is correct
var req = ocpu.call("XXX",{},function(session){
}).done(function(){
// THIS IS WHERE I NEED CODE TO LET THE #WIZARD TO FORWARD TO NEXT STEP BECAUSE THE FOLLOWING RETURN TRUE WON'T BE WORKING.
})
// return true;
}
});
---- 添加
我不认为
$("#wizard").steps("next");在onStepChanging 工作。例如,
HTML:
<div id="wizard">
<h3>Step-1</h3>
<section>
First
</section>
<h3>Step-2</h3>
<section>
Second
</section>
</div>
JS:
$("#wizard").steps({
headerTag: "h3",
bodyTag: "section",
transitionEffect: "slideLeft",
autoFocus: true,
onStepChanging: function(e, currentIndex, newIndex){
console.log(currentIndex) // returns many many 0s but cannot go to 1.
$("#wizard").steps("next");
}
})
【问题讨论】:
-
jquery 步骤插件将对象作为参数,而不是字符串。
-
documentation 表明解决方案可能是
$("#wizard").steps("next")。 -
你能发布你的html吗?
-
@Xufox 对我来说似乎是正确的。下一次,也许看看 API,尤其是只有 11 种方法......
-
@Xufox 不,我不认为
$("#wizard").steps("next")有效。请查看更新。
标签: javascript jquery jquery-steps