Brendon Grundlingh
Brendon Grundlingh

Reputation: 71

Bootstrap-Wizard: onPrevious not working with if index?

I am using a bootstrap wizard in one of my applications but i noticed when i try and use the index position of the tabs to achieve a certain goal it would only work with the next button, not the previous button. onPrevious works, just wont go into the if statement.

$('#rootwizard').bootstrapWizard({
        'tabClass': 'bwizard-steps',
        onTabClick: function(tab, navigation, index) {
            return false;
        },
        onNext: function(tab, navigation, index) {

            alert('this works');

            if (index === 1) {
                alert('this works');
            }

        },
        onPrevious: function(tab, navigation, index) {

            alert('this works');

            if (index === 2) {
                alert('this doesn't work');
            }
        }
    });

My goal is specific with the 2nd tab previous button, but it simply wont work despite the code being exactly the same as the onNext witch works perfectly. Any ideas?

Upvotes: 1

Views: 643

Answers (1)

Lucas Peralta
Lucas Peralta

Reputation: 26

if you have two tabs the index are 0 and 1 , not 1 and 2

index has the value of the tab where you are going to be, not the tab where you are

Upvotes: 0

Related Questions