Iterate through tabs in JQuery UI Tabs
I'm trying to 开发者_运维百科load data to a tab panel (ui.panel) and then activate related tab through .tabs("select", ui.index).
How can I iterate through all ui objects in jQuery UI Tabs? Those that are available through load method of UI Tabs object.
This is how I achieved my goal:
var $tabs = $("#tabContainer").tabs({
load: function(event, ui){
$("a.updateTab").live("click", function(){
// href for links are replaced by jq tabs with this pattern (pseudocode):
// a.href = "#" + a.title.replace(" ", "_")
// so we're searching a tab wich content should be reloaded
var tabItemId = "#Menu_" + "some text";
var index = $(".ui-tabs-panel", $tabs).index($(tabItemId));
$tabs.tabs("url", index, this.href);
$tabs.tabs("select", index);
return false;
});
}
});
精彩评论