Aaron
Aaron

Reputation: 33

How to change tab with Bootstrap & Jquery

I want to change tab with on #rootwizard, I have this code, but I can not go to tab1 with jquery.

$('#rootwizard').find("a [href *= 'tab1']").trigger('click');

Leads me tab2
tab2 leads me to tab3 and so on.

$('#rootwizard .finish').click(function() {
    alert('Finished!, Starting over!');
    $('#rootwizard').find("a[href*='tab1']").trigger('click');
});

This doesn't work for the first position. I need go to tab1, but go to SECOND.

tab1 --> SECOND.

tab2 --> THIRD.

( I need tab1 --> FIRST )

Here is an example.

Upvotes: 0

Views: 909

Answers (2)

Jess Hyv
Jess Hyv

Reputation: 1

this works fine !

$('#rootwizard').bootstrapWizard('next')

Upvotes: 0

Biswas
Biswas

Reputation: 598

I think the problem is with the index. The first tab starts with index 0, and the second one with 1 and so on, so i think you should do

$('#rootwizard .finish').click(function() {
        alert('Finished!, Starting over!');
        $('#rootwizard').find("a[href*='tab0']").trigger('click');
    });

Thanks,

Upvotes: 1

Related Questions