On 2 Nov., 06:33, stevel <[EMAIL PROTECTED]> wrote:
> I was trying to use the Tab select option to save the current tab
> index to a cookie.
> It is my understanding that the select option executes a function when
> a tab is clicked. In this function I was trying to get currently
> selected using the .data("selected.tabs");  Here are my codes:
>
> jQuery(document).ready(function(){
>     var tab_cookie_id = jQuery.cookie("todos_tab") || 0;
>     jQuery("#taskboard > ul").tabs({
>         selected: tab_cookie_id,
>         select: function(e,ui){
>             var $tabs = jQuery('#taskboard >
> ul').tabs().data("selected.tabs");
>             jQuery.cookie("todos_tab", $tabs);
>         }
>     });
>
> However what I am getting was the previously selected tab index and
> not the tab that I just clicked. It seems that clicking a tab does not
> update the selected tab index immediately but rather only after the
> select option function has completed.  Is this the normal behavior?

Yes it is. Answer to the problem here for example:
http://groups.google.com/group/jquery-ui/msg/766901b922b97d7c


> If this is indeed the normal behavior, how do I accomplish what I was
> trying to do, which is saving the latest tab index to a cookie each
> time a tab is clicked?

Just use the cookie option, UI Tabs has build-in cookie support.

jQuery("#taskboard > ul").tabs({
    cookie: { expires: 7 }
});


--Klaus

--~--~---------~--~----~------------~-------~--~----~
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