How to save and get the state of a tab in jQuery without setting cookies

StackOverflow https://stackoverflow.com/questions/23469719

  •  15-07-2023
  •  | 
  •  

سؤال

I have a simple horizontal tab-list containing 4 tabs. The correct content is loaded, when it's associated tab is clicked, but...

when I referesh the page, the selected tab will default back to the first tab in the row, which is undesireable.

So, how can I save the open tab across page loads? I read somewhere, that the cookie-method is deprectated in jQuery.

Now, am I to use local storage? And if so, how does it work?

Thanks! :)

هل كانت مفيدة؟

المحلول

Web storage will be the better option if you don't want to use cookies. You can get webstorage examples here : http://www.w3schools.com/html/html5_webstorage.asp

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top