I am using a jQuery-steps on my app to for a wizard-like situation. I am having trouble finding out how to change to a custom step though. Any help with this one?
$(function () {
$("#wizard").steps({
headerTag: "h2",
bodyTag: "section",
transitionEffect: "slideLeft",
enableFinishButton: false,
labels: {
next: $('#next').html(),
previous : $('#previous').html()
},
onStepChanged: function (event, currentIndex, priorIndex)
{
if( priorIndex == 0) {
var selected = $('input[name=radio_wizard]:checked', '#radio_wizard').val()
switch( selected ){
case 1:
// GOTO 1
break;
case 2:
// GOTO 2
break;
case 3:
// GOTO 3
break;
}
}
}
}
How to achieve this?
I did this so I created this new function:
function _goToStep(wizard, options, state, index)
{
return paginationClick(wizard, options, state, index);
}
And the call that is not implemented, put this:
$.fn.steps.setStep = function (step)
{
var options = getOptions(this),
state = getState(this);
return _goToStep(this, options, state, step);
};
Just taking advantage of what already existed plugin.
Use:
wizard.steps("setStep", 1);
I found a simple way to do this. you can use the jquery function
$("#wizard-t-2").get(0).click();
assuming you know what step you want to go to. this example would bring you to the third step of the wizard. use chromes editor to figure out what the exact id is of the step you want to go to.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With