Thanks for your reply, Tristan. Unfortunately, that solution only works if
the tabs are never changed. For example, if tomorrow my client asks me to
switch tab 2 with tab 4, I will have to update my html *and* javascript. I
would prefer to not have to update the javascript, which would be possible
if the ui object could return the shown tab element directly.
For example, something like this would be perfect:

$('ul.tabs').tabs({
   show: function(event, ui) {
       var shownTab = ui.shownTab;
       // disable form elements on the shown tab
       shownTab.find('input', 'select').attr('disabled', 'disabled');
   }
});

Is there anything like that available? Thanks!

-Hector


On Fri, Nov 14, 2008 at 11:56 AM, Tristan <[EMAIL PROTECTED]> wrote:

>
> Use "ui.index" to access the currently active tab's index, zero being
> the first tab and so on.
>
> $('ul.tabs').tabs({
>    show: function(event, ui) {
>         if (ui.index == 0) {
>            // do stuff
>        } else if (ui.index == 1) {
>            // do other stuff
>        }
>    }
> });
>
> On Nov 14, 2:39 pm, "Hector Virgen" <[EMAIL PROTECTED]> wrote:
> > Hello,
> >
> > I am using Tabs from jQueryUI. I have a callback function for when the
> > selected tab is shown:
> >
> > $('ul.tabs').tabs({
> >     show: function(event, ui) {
> >         // do stuff
> >     }
> >
> > });
> >
> > When the tab is shown, I need to pre-populate its form with values based
> on
> > cookie data. How can I tell which tab is shown? Or, more specifically,
> how
> > can I get the shown tab container? Do I have to query for it manually
> with
> > $('div.ui-tabs-panel:visible)?
> >
> > Thanks!
> >
> > -Hector
>

Reply via email to