tags:

views:

41

answers:

2

Hi,

I'm using jQuery tabs, and trying to save the positions of the Tabs (and of course the content in the tabs). Could you please suggest me a way to do the same?

Regards

A: 

You can set which tab is active by using the selected property

$('.selector').tabs({ selected: 3 });

You'll also need a way of storing which tab is active. For that we have the select event, you can listen for the select event, and then on the callback either send an Ajax call back to the server with the information (which tab is active), or create a cookie where you store the same information.

Then when the page loads you just need to either get that information from the server or the cookie, and use the select property to set the active tab.

Frederik Vig
We can save the active tabs by using selected property, but how can we decide/save the order of the tabs?
Either in a cookie or on the server. Use the select event (which gets triggered every time the selected tab changes) to call a callback function that creates/updates the cookie, or sends the data back to the server with Ajax.
Frederik Vig
+1  A: 

the order is defined by the element position in html, not the tabs plugin, not jquery, not javascript.

antpaw
Thanks you are right :), that is Simple :(