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?
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:
Call that is not implemented, put this:
$.fn.steps.setStep = function (step)
{
var options = getOptions(this),
state = getState(this);
return _goToStep(this, options, state, index); //Index Instead step
};
wizard.steps("setStep", 1);
works just fine
onInit: function(event) {
let div = event.currentTarget;
let lis = div.getElementsByTagName('li');
// Choose second tab
// active is just show style, only effective after clicking tag a.
lis[1].className += ' active';
$(lis[1]).children('a').click();
}
This is the simplest solution i found.
var tablist_item = 'ef_users_list-t-';
var step = 2; // step number to jump to
$(tablist_item+step).trigger('click');
take the id of the step you want go and add a trigger!
$("#steps-uid-0-t-1").trigger("click");
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);
Basing on @AbdulJamal answer, I've implemented it for any step:
$(function () {
var stepsWizard = $("#wizard").steps({
...
});
// step variable handles current step (from 0)
for(var i=0; i<step; i++) {
stepsWizard.steps("next");
}
});
Note that step
variable must be defined and equal or greater than 0.