Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8178667
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T23:49:11+00:00 2026-06-06T23:49:11+00:00

a while ago i asked this question Jquery tabs keep tab open that is

  • 0

a while ago i asked this question Jquery tabs keep tab open that is subid in url and you can see that i found an answer to my question, now i am trying to alter it so that each time you change from tab to tab it changes the tid subid in the header, at the moment it just changes the variable tid to whatever the tab_id is, so that when you press back, you can open the specific tab you left from, but this time i want it to update the tid in the header as you scroll through the tabs.

In case the link to my previous answer doesn’t show here is my code

function getParameterByName(name) {
    name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
    var regexS = "[\\?&]" + name + "=([^&#]*)";
    var regex = new RegExp(regexS);
    var results = regex.exec(window.location.search);
    if (results == null) return "";
    else return decodeURIComponent(results[1].replace(/\+/g, " "));
}
$(document).ready(function () {
    $(".tab_content").hide(); //Hide all content
    var tabIndex = parseInt(getParameterByName('tid'), 10);
    if (!tabIndex) tabIndex = 1;
    $("ul.tabs li").eq(tabIndex - 1).addClass("active").show(); //Activate first tab
    $(".tab_content").eq(tabIndex - 1).show(); //Show first tab content
    //On Click Event
    $("ul.tabs li").click(function () {
        $("ul.tabs li").removeClass("active"); //Remove any "active" class
        $(this).addClass("active"); //Add "active" class to selected tab
        $(".tab_content").hide(); //Hide all tab content
        var activeTab = $(this).find("a").attr("href"); //Find the rel attribute value to identify the active tab + content
        $(activeTab).fadeIn(); //Fade in the active content
        return false;
    });
});

Let me know if you need anything else and sorry if this is a little confusing.

EDIT: In other words at the moment if i add ?tid=2 in the header then it will go to the second tab, but it will not update it automatically when you change tab

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T23:49:12+00:00Added an answer on June 6, 2026 at 11:49 pm

    Attempting to change the tid parameter of the current URL using Javascript without reloading the page will NOT work. You have a couple of options:

    1. Make the tab actually just a link to a new page instead of using JavaScript.
    2. Alter your script so that the tabs are actually id links, like so:

      <li><a href="#inbox" class="inbox"></a></li>

    When you click a tab, #outbox or #inbox should be appended to the URL for you. Then when the user clicks the back button, it should bring them to the previous URL. You will also have to alter your JavaScript so that when the page loads w/ a link to a tab in it (i.e. page.html#inbox), then the inbox tab shows.

    It seems that you already have the appropriate ids and links in your HTML, but for some reason your are adding a click function to your <li> elements instead of your <a> elements. You should make your <a> elements have display:block so that they full your <li> elements and then you can add the tab-switching functionality to them instead. This will enable the id to be appended to the URL (i.e. page.html#inbox).

    So try adding the onclick functions to your links instead:

    $("ul.tabs li a").click(function () {
            $("ul.tabs li").removeClass("active"); //Remove any "active" class
            $(this).parent().addClass("active"); //Add "active" class to selected tab
            $(".tab_content").hide(); //Hide all tab content
            var activeTab = $(this).attr("href");
            $(activeTab).fadeIn(); //Fade in the active content
        });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

While I realize that this question has been asked once or twice ago but
I asked this question a while ago and got an answer that I thought
This question was asked quite some time ago, and while it covers possible solutions
UPDATE 10/19/2010 I know I asked this question a while ago, but the workarounds
This question is related to this initial question asked a little while ago. Now,
Okay so I know I asked a similar question a while ago, but this
A while ago I asked this question about how to defer updates to an
I asked this question a while ago, and the answer provided was satisfactory to
This is similar to a question I asked a while ago, however this didn't
This is an extension of a question I asked a wee while ago which

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.