Twitter bootstrap - Dynamically added tabs not working -


i using twitter bootstrap in application. in specific case, need add tabs dynamically after ajax request.

i added li tag tab head , respective content area relevent id specified in href of tab head anchor.

but newly added tabs not working bootstrap tabs. tried refresh tabs functionality calling $("#tabs1").tabs() right after new tab added dynamically, no use.

please suggest me on how use bootstrap tabs dynamic data.

note : other tabs there during page load works fine.

you have initialize tabs using $(...).on() instead of $(...).click(). on way can bind click event parent #mytab-element , not directly child a-tags.

$("#mytab").on("click", "a", function(e){   e.preventdefault();   $(this).tab('show'); }); 

now click-event bount #mytab-element , delegated child a-tags.

  • here can find running demo
  • read jquery doc more info on "on event handlers"

Comments

Popular posts from this blog

c# - SVN Error : "svnadmin: E205000: Too many arguments" -

c# - Copy ObservableCollection to another ObservableCollection -

All overlapping substrings matching a java regex -