jquery question cookie

hi all

i currently have this jquery tab set up  http://jqueryui.com/demos/tabs/
but i would like to set a cookie to save the link last used for when the page reloads.
i have taken a look at this http://jqueryui.com/demos/tabs/#cookie
but cant find a example of code for setting the cookie.

how do i set this cookie ?
LVL 1
helpchrisplzAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Phil PhillipsDevOps ArchitectCommented:
Here's a good blog post on how to manage cookies with javascript: http://jquery-howto.blogspot.com/2010/09/jquery-cookies-getsetdelete-plugin.html

It shows both a conventional way and the jQuery way.   HTH.
0
Phil PhillipsDevOps ArchitectCommented:
I'm sorry, I misread the question.

The tabs feature for jQuery UI will automatically set the cookie for you, as long as you tell it to.   If you look at the source for the cookie persistance, you'll see:

<script>
$(function() {
	$( "#tabs" ).tabs({
		cookie: {
			// store cookie for a day, without, it would be a session cookie
			expires: 1
		}
	});
});
</script>

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
helpchrisplzAuthor Commented:
ok so i have this but its not saving the tab on page reload. ?




<script type="text/javascript" src="js/jquery-1.5.1.min.js"></script>
<script type="text/javascript" src="js/jquery-ui-1.8.11.custom.min.js"></script>
<script type="text/javascript" src="js/jquery.cookie.js"></script>


 <script>
$(function() {
      $( "#tabs" ).tabs({
            cookie: {
                  // store cookie for a day, without, it would be a session cookie
                  expires: 1
            }
      });
});
</script>
   
      <div class="demo">
        <div id="tabs">
       
       

          <ul>
            <li><a href="#tabs-1">Appointment options</a></li>
            <li><a href="#tabs-2">Add or remove patient</a></li>
            <li><a href="#tabs-3">Practitioner options</a></li>
            <li><a href="#tabs-4">Treatment options</a></li>
          </ul>
          <div id="tabs-1">Appointment options</div>
<div id="tabs-2">Add or remove patient</div>
<div id="tabs-3">Practitioner options</div>
<div id="tabs-4">Treatment options</div>
</div>
</div>
0
helpchrisplzAuthor Commented:
ok it seems to be working now :)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.