Jump to content

session help


aaronxbond

Recommended Posts

so i have these jquery tabs, and depending on what tab you click, there is a section of text that changes along with it

well when you leave the page and return, the default content is showing while the tab that you were on when you left the page is still selected.

i know it has to do with session to show the content and the tab that you were just on

how can i go about doing that?

 

<h4 style="margin-top:20px;line-height:20px;"><span class="gold" id="tabtitle">Tab 1.</span> <span id="tabdesc">This is the description of the first tab.</span></h4>

 

<ul id="indextabs" class="studenttabs" style="margin:10px 0px 0px 0px;">

<li class="selected"><a href="#" id="tabone" rel="tab1">Tab 1</a></li>

<li><a href="#" id="tabtwo" rel="tab2">Tab 2</a></li>

<li><a href="#" id="tabthree" rel="tab3">Tab 3</a></li>

<li><a href="#" id="tabfour" rel="tab4">Tab 4</a></li>

</ul>

 

 

$("#tabone").click(function () {

      $('#tabdesc').text('This is the description of the first tab.');

      $('#tabtitle').text('Tab 1.');

  });

 

  $("#tabtwo").click(function () {

      $('#tabdesc').text('This is the description of the second tab. ');

      $('#tabtitle').text('Tab 2.');

  });

 

$("#tabthree").click(function () {

      $('#tabdesc').text('This is the description of the third tab.');

      $('#tabtitle').text('Tab 3.');

  });

 

  $("#tabfour").click(function () {

      $('#tabdesc').text('This is the description of the fourth tab. ');

      $('#tabtitle').text('Tab 4.');

  });

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/144688-session-help/
Share on other sites

I'd recommend using a cookie for this. That was you can extend the existing javascript to set a cookie when a tab is chosen. On return to the page you can check that cookie to set the visible content.

 

thats the problem im havin

im having a major brain fart and cant think of the way to do that

 

Link to comment
https://forums.phpfreaks.com/topic/144688-session-help/#findComment-759645
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.