Javascript tab help (Go to last selected tab upon refresh)

I decided to find some javascript code online that allowed me to create "tabs" into different divs.

The problem is that when I refresh the page, it automatically goes back to the first tab. I've tried all different variations of the code, but not coming with the answer. I also tried setting the "currentTab" as the last clicked, but I think I'm just not using correct syntax because currentTab doesn't get created until the tab is clicked.

Anyway, here's the code:

<script type="text/javascript">


$('#user_content .maintab').hide(); // Hide all divs that are 'hideable'

$('#user_content #top').show();

$('#user_content div:first').show(); // Show the first div

$('#user_content ul li:first').addClass('first'); // Set the class of the first link to active

$('#user_content ul li a').click(

function(){ // When any link is clicked

$('#user_content ul li').removeClass('active'); // Remove active class from all links

$('#user_content ul li').removeClass('first');






$(this).parent().addClass('active'); // Set clicked link class to active


var currentTab = $(this).attr('href'); // Set variable currentTab to value of href attribute of clicked link


$('#user_content .maintab').hide(); // Hide all divs that are 'hideable'

$('#user_content #top').show();

$(currentTab).show(); // Show div with id equal to variable currentTab

return false;




If you can help me fix this small issue that'd be great. I will not accept any bids that are more than the minimum amount. This job is too small to give anymore than that. Thanks

Skills: AJAX, Javascript, jQuery / Prototype

See more: javascript tab help, javascript tabs refresh, javascript last selected tab, tab javascript,, li-be, job javascript, javascript go to, help me fix this, help me fix it, help me find a job, go to top javascript, go to top code, go javascript, find javascript, find help, answer tab, refresh, last, divs, text alert, upon javascript, ajax hide show, job alert script, javascript hide show

About the Employer:
( 4 reviews ) Pittsburgh, United States

Project ID: #1146655

Awarded to:


please provide me complete page (script+html) i will do now.. i am an expert jquery,javascript programmer

$30 USD in 0 days
(8 Reviews)

9 freelancers are bidding on average $30 for this job


please check your pmb

$30 USD in 1 day
(129 Reviews)

You have [url removed, login to view]

$30 USD in 1 day
(56 Reviews)

Hi, good at quick fixes. kindly check PMB.

$30 USD in 1 day
(60 Reviews)

Ready to work on your project right now, I have done one similar project before. Plz check PMB.

$30 USD in 0 days
(53 Reviews)

30+ years bending bits affords you 100% satisfaction guaranteed! Please see PM for more.

$30 USD in 1 day
(19 Reviews)

Hi. I can help you.

$30 USD in 0 days
(1 Review)

hi buyer, please check pmb.

$30 USD in 1 day
(2 Reviews)

Hello Sir I am ready to do. JavaScript expert is here for quality work.

$30 USD in 0 days
(1 Review)