Close all tabs:

$('.ui-tabs-nav').each(function() {
    var $tabs = $(this);
    for (var i = 0, tabs = $tabs.tabs('length'); i < tabs; i++) {
            $tabs.tabs('remove', i);
    });
});

If you want to allow only one tab open you could hook into select, so
that with every tab select you would close all other open tabs:

var tabs = $('#foo, #bar, #baz').tabs({
    deselectable: true,
    selected: false,
    select: function(e, ui) {
        var ul = $(ui.tab).parents('ul:first');
        $.each(tabs, function(i, el) {
            if (el != ul) {
                $(el).tabs('select', $(el).data('selected.tabs'));
            }
        });
    }
});


Both untested.

--Klaus


On 5 Nov., 15:56, led <[EMAIL PROTECTED]> wrote:
> Hi.My first post about jquery.
> The question is how can i reference all ui.tabs objects in a page and
> close all tabs from all ui tabs.
> It's that i have tabs generated from a databse results query and i
> need to close all tabs from all ui.tabs before i open another. Or a
> way to prevent opening more than one tab per page.
>
> Thanks in advance.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"jQuery UI" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/jquery-ui?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to