I have a js function that adds an extra tab + panel to an existing JQuery UI tab widget upon the click of a button,
let $tabs = $('#my-tab').tabs(options);
$button.click(function(e){
let $newtab = $('#additional-tab'),
$newpanle = $('#additional-panel'),
ref = '#'+$newpanel.attr('id');
$tabs.children('ul').append($newtab);
$tabs.append($newpanel);
//I would now like to load the newly created tab.
$tabs.on('tabscreate', function(e,ui){
$tabs.tabs("load",ref);
});
//refresh to enable the new tab/panel.
$tabs.tabs("refresh");
})
The new tab/panel get created, but I wish to load it once the widget is "refresh"ed. I have tried to bind to all the events a tabs widget fires,
$tabs.on('tabsbeforeactivate,tabsbeforeload, tabscreate, tabsload, tabsactivate', function(e,ui){
$tabs.tabs("load",ref);
});
but none of them are fired by the widget when it is refreshed.
Is there another way to achieve this?