Solved

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

Posted on 2012-03-29
5
354 Views
Last Modified: 2012-03-31
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
Comment
Question by:unistudent
  • 3
5 Comments
 
LVL 40

Accepted Solution

by:
gurvinder372 earned 500 total points
Comment Utility
0
 

Author Comment

by:unistudent
Comment Utility
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
 

Author Comment

by:unistudent
Comment Utility
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
 

Author Comment

by:unistudent
Comment Utility
Thank you for your advice. gurvinder372Posted
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now