1

Topic: Prompt under tabs in Bootstrap

There is such imposition: https://jsfiddle.net/u8f92807/1/
Some tabs with the text.
I want to place in the text of the reference which would switch tabs (in the given example such link is on tab Tab 3).
At a clique on this link contents change, but immediately bookmarks do not change (that is the selected tab does not change).
I not so do something? Or to change the selected tab it is necessary manually?

2

Re: Prompt under tabs in Bootstrap

I tried to switch tabs the code: $ ().tab (' show ')
But the result turned out the same - tab contents switched, but the selected bookmark in title did not change.
If manually to change a class active in role = "tablist" the bookmark in title changes, but most likely there is more direct method.

3

Re: Prompt under tabs in Bootstrap

Made thus:

$('.tab-content.tab-pane a [role = "tab"] ').on (' click ', function (event) {
var $id = $ (this).attr (' href ');
if (! $id) return;
event.preventDefault ();
var $tab = $ (this).closest ('.tab-content ').parent ();
var $lst = $tab.find (' [role = "tablist"] ');
var $ref = $lst.find (' [role = "tab"] ');
$ref = $ref.filter (' [href = "' + $ id + '"] ');
$ref.tab (' show ');
});

Appropriate links should be inside.tab-pane and have attribute role = "tab".
Now all works.
But if in Bootstrap there is a regular method for such task, it would be desirable to use it.