Reputation: 505
I followed this tutorial to make a tabbed menu for a WordPress plugin I've created. I would like the tab that was open when the form was last saved to be the tab that is open when the page reloads.
I have 6 tabs, Settings, and Group 1 through Group 5. If they are on Group 3 and click to save the form, right now it reloads on the Settings tab. I would like it to open on Group 3. I was thinking of dropping a cookie every time they clicked on a new tab, but that doesn't seem like the cleanest way to do this. Any suggestions?
Upvotes: 0
Views: 511
Reputation: 5596
I think you can use localStorage
or sessionStorage
depending on your usage. They can be used to store temporary / persistent data at the client browser:
// set data
sessionStorage.setItem("currentTab", tabid);
// get data
var tabid = sessionStorage.getItem("currentTab");
Check this out for more information.
Upvotes: 1