Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 388
  • Last Modified:

JQuery - does not go to the selected tab after reloading the page

I have used the following to store the selected tab "index" to the document.cookie, the document.cookie stores the correct selected tab index. However,  $('#tabs').tabs('select', document.cookie); is not working, does not go to the selected tab index.

Below is my codes, please advise

<script type="text/javascript">
$(function(){
      $('#tabs').tabs();
      $(document).ready(function() {
         // $('#tabs').tabs('select', $.cookie("tabNumber"));
       alert("document.cookie[" + document.cookie + "]");
         $('#tabs').tabs('select', document.cookie);   <== this one seems not to be corect

         $('#tabs').click(function() {
            var selected = $('#tabs').tabs('option', 'selected');
            document.cookie = selected;
           //$.cookie("myselectedtab", $tabs.tabs('option', 'selected'));
         });
      });
});
</script>
0
unistudent
Asked:
unistudent
  • 3
1 Solution
 
Gurvinder Pal SinghCommented:
0
 
unistudentAuthor Commented:
I know EE Administrator. I have done all my work myself and asked for some questions I dont understand. I have honestly told my lecturer about asking some advice from here. they all say ok. I am not asking for people giving me codes.
0
 
unistudentAuthor Commented:
Dont know why it does not work i have read and tried based on http://jqueryui.com/demos/tabs/#cookie. anyway, i use document.cookie instead. it works.
0
 
unistudentAuthor Commented:
Thank you for your advice. gurvinder372Posted
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now