Here is my JS code, I want to use javascript to make my wizard
next step but I don't know what code I should write.
$("#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;
}
});
---- Added
I don't think the
$("#wizard").steps("next");
works in onStepChanging
. Example,
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");
}
})