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

In Progress

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">

$(document).ready(function(){

$('#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');

//alert($(this).attr('href'));

if($(this).attr('href')=='#user_profile_overview'){

$(this).parent().addClass('first');

}

else{

$(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

//alert(currentTab);

$('#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;

});

});

</script>

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:

sanjuintelligo

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)
3.5

9 freelancers are bidding on average $30 for this job

jDevAndDesign

please check your pmb

$30 USD in 1 day
(129 Reviews)
6.6
acesolution

You have inbox.thanks

$30 USD in 1 day
(56 Reviews)
5.7
siddhu1986

Hi, good at quick fixes. kindly check PMB.

$30 USD in 1 day
(60 Reviews)
5.5
maleo

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)
5.3
Tomcat253

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

$30 USD in 1 day
(19 Reviews)
4.5
AlphaVisual

Hi. I can help you.

$30 USD in 0 days
(1 Review)
2.6
nixtuan

hi buyer, please check pmb.

$30 USD in 1 day
(2 Reviews)
1.8
AmeerHyder

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

$30 USD in 0 days
(1 Review)
1.4