Question

I am using jQuery Steps and I am wanting to handle an event called: onStepChanging.

The default value is function (event, currentIndex, newIndex) { return true; }

I have tried the following, with no luck:

$("#wizard").onStepChanging(function (event, currentIndex, newIndex){
    Console.log("onStepChanging");
});

Can I please have some help to get this working?

Thanks in advance

Was it helpful?

Solution 2

Here is the answer, it took a bit of trying, but this works:

$("#wizard").steps({
    headerTag: "h2",
    bodyTag: "section",
    transitionEffect: "slideLeft",
    stepsOrientation: "vertical",
    onStepChanging: function (event, currentIndex, newIndex){
        //alert("stepchanging event");
        return true;
    }
});

OTHER TIPS

You should use a lowercase 'c' for console.log().

The "C" in "Console" should be lowercase. A good debug method for something like this would be to try a different output like alert("This is working"); to tell if it is the event handler or the output that is the problem.

You could try this:

$("#wizard").on("stepchanging", function (event, currentIndex, newIndex){
    console.log("onStepChanging");
});

Just check the case of that first parameter. I'm not sure if the way I wrote will fit perfectly.

The $().on triggers a function then certain event is fired.

Also, the console is lowercase.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top