Reputation: 61
I'm trying to append tab information to an existing jQuery UI Tab container and then re-initialize the tab container to update the contents.
Here's a simple JSFiddle of what I'm trying to do: http://jsfiddle.net/dmchale92/Wa69N/
Here's the function I'm using to append a basic test paragraph:
$(function () {
a = "<div id='tabs-4'><p>This is a test paragraph.</p></div>"
b = "<li><a href='#tabs-4'>Blog Four</a></li>"
$("#tabs").append(a);
$("#tablist").append(b);
$("#tabs").tabs();
});
Can anybody explain to me why the new tab title doesn't keep the style of the other tabs, and why the contents are added to the bottom outside of the container instead of paginated?
Upvotes: 0
Views: 196
Reputation: 2038
You need to do this
$(function () {
$('#tabs').tabs("destroy");
a = "<div id='tabs-4'><p>This is a test paragraph.</p></div>"
b = "<li><a href='#tabs-4'>Blog Four</a></li>"
$("#tabs").append(a);
$("#tablist").append(b);
$("#tabs").tabs();
});
http://jsfiddle.net/farrukhsubhani/Wa69N/2/
Upvotes: 0