I'm trying to get the index of a tab when it opens in Twitter Bootstrap (3.3), but it keeps giving me an index of 0
. I've checked out this question but a)
it's apparently for an older version of Bootstrap (shown
instead of shown.bs.tab
, etc), and b)
I tried to use an updated version of the code(shown.bs.tab
) and it didn't work.
Any idea of how to do this in Bootstrap 3.3?
$('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
console.log($(e.target).index());
});