html - Activate tabs with jQuery -
i have system create, delete , rename tabs using jquery. trying set when new tab created activates tab nothing seems working. have tried tab api on twitter bootstrap page not seem work.
jsfiddle: http://jsfiddle.net/benedictlewis/eyepa/
what have tried:
$('#mytab a[href="#profile"]').tab('show'); // select tab name $('#mytab a:first').tab('show'); // select first tab $('#mytab a:last').tab('show'); // select last tab $('#mytab li:eq(2) a').tab('show'); // select third tab (0-indexed)
short version - forgot add id
link. why $('#tab' + tabcount).tab('show');
doesn't work.
if change line 5 to
.append($('<li><a href="#tab' + tabcount + '" id="tablnk' + tabcount + '" data-toggle="tab">new page ' + tabcount + ' <i class="icon-remove tab-remove"></i></a></li>'));
and line 8 to
$('#tablnk' + tabcount).tab('show');
it works fine.
Comments
Post a Comment