Solved

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

Posted on 2012-03-29
5
369 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
5 Comments
 
LVL 40

Accepted Solution

by:
gurvinder372 earned 500 total points
ID: 37781163
0
 

Author Comment

by:unistudent
ID: 37790701
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
ID: 37790703
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
ID: 37790705
Thank you for your advice. gurvinder372Posted
0

Featured Post

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: DanRollins
This article describes a JavaScript program that creates a maze made of hexagonal cells.  In Part 2 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7850-Hex-Maze-Part-2.html), we'll extend the program by adding a depth-…
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…
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…

724 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