Spiga

jQuery UI bootstrap tabs remember last selected tab

by Gabi Solomon

I have started working with Bootstrap UI from Twitter and i love it. I had some trouble though with the tabs component that did not remember the last tab selected on refresh.

You can easily edit the component to allow for this feature:

- comment the line bellow from the TAB DATA-API

// e.preventDefault()

- add the following code below the TAB DATA-API

$('ul.nav-tabs li a[data-toggle="tab"]').each(function(){
if ($(this).attr("href") == window.location.hash) {
$(this).tab('show')
}
});

- add an anchor to all your tabs links