Saturday, May 11, 2024
160
rated 0 times [  161] [ 1]  / answers: 1 / hits: 16500  / 12 Years ago, mon, april 2, 2012, 12:00:00

I am using Twiter Bootstrap Tabs on my page. I want to dynamically add tabs in the view. Currently I am using this code, which is not working



$('#tab').append('<li><a href=#tabname data-toggle=tab>Tab Name</a></li>');
$('#myTabContent').append('<div class=tab-pane fade in active id=tabname><p>tab content</p></div>');
$('#tab a:last').tab('show');


Can Any body tell me what I am missing?


More From » twitter-bootstrap

 Answers
84

Now I am using this code that's working



$('div.active').removeClass('active').removeClass('in');
$('li.active').removeClass('active');

$('#myTabContent').append('<div class=tab-pane in active id=new_tab_id><p> Loading content ...</p></div>');
$('#tab').append('<li><a href=#new_tab_id data-toggle=tab>Tab Name</a></li>');
$('#tab a:last').tab('show');

[#86459] Saturday, March 31, 2012, 12 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
donovanjasek

Total Points: 465
Total Questions: 103
Total Answers: 113

Location: Saint Vincent and the Grenadines
Member since Thu, Oct 15, 2020
4 Years ago
donovanjasek questions
Wed, Jun 23, 21, 00:00, 3 Years ago
Fri, Jun 12, 20, 00:00, 4 Years ago
Mon, Nov 25, 19, 00:00, 5 Years ago
Mon, Oct 15, 18, 00:00, 6 Years ago
;