Twitter Bootstrap assigns the active
class to the li
element that represents the active tab:
$("ul#sampleTabs li.active")
An alternative is to bind the shown
event of each tab, and save the active tab:
var activeTab = null;
$('a[data-toggle="tab"]').on('shown', function (e) {
activeTab = e.target;
})