On 16 Mrz., 14:25, jjsanders <jigalroe...@gmail.com> wrote:
> Hello,
>
> I am using still the old version of ui (not the 1.7)
>
> I saw
> herehttp://docs.jquery.com/UI/Tabs#...select_a_tab_from_a_text_link_inste...
> the posibility to navigate between tabs by using a link and not the
> tabs.
>
> I implemented the code in my site but wanted to make it more dynamic:
>
> $('#verder').click(function() { // bind click event to link
> var $tabs = $('#tabs').tabs();
> var selected = $tabs.data('selected.tabs');
> //console.log(selected);
> $tabs.tabs('select', selected +1); // switch to third
> tab
> return false;
> });
>
> But now it only works from the first to the second tab. From the
> second to the third tab and it doesn't work.
> How can i make it work?
The problem is that you're (re)tabifying with every click: var $tabs =
$('#tabs').tabs() which should only happen once. So:
var $tabs = $('#tabs').tabs(); // or whereever it was called once
before
$('#verder').click(function() { // bind click event to link
var selected = $tabs.data('selected.tabs');
$tabs.tabs('select', selected + 1); // switch to third tab
return false;
});
--Klaus