aaronxbond Posted February 10, 2009 Share Posted February 10, 2009 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.'); }); Quote Link to comment https://forums.phpfreaks.com/topic/144688-session-help/ Share on other sites More sharing options...
gevans Posted February 10, 2009 Share Posted February 10, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/144688-session-help/#findComment-759293 Share on other sites More sharing options...
aaronxbond Posted February 11, 2009 Author Share Posted February 11, 2009 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 Quote Link to comment https://forums.phpfreaks.com/topic/144688-session-help/#findComment-759645 Share on other sites More sharing options...
premiso Posted February 11, 2009 Share Posted February 11, 2009 http://techpatterns.com/downloads/javascript_cookies.php Google is your friend. Quote Link to comment https://forums.phpfreaks.com/topic/144688-session-help/#findComment-759708 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.