• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 384
  • 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

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

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