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 6159475
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T21:08:22+00:00 2026-05-23T21:08:22+00:00

I am doing a leaderboard for a website we are working on. Essentially, we

  • 0

I am doing a leaderboard for a website we are working on.

Essentially, we have a div with this months winner for location A

Below we have ajax tabs, where user can click tabs which relate to locations, like :

Location A
Location B
etc etc

So by default, when page loads, tab A is open. And the div above we need to give a matching ID, because…

I want as the user clicks tab B for the div above to change, with different DIV ID. So basically we can change content in the div based on the tab the user clicks.

So the content div is like:

<div id="???"> content goes here </div>

The tabs are like:

<ul class="tabs"> 
                    <li><a href="#tab1"><span class="stateTab">NSW</span></a></li> 
                    <li><a href="#tab2"><span class="stateTab">QLD</span></a></li> 
                    <li><a href="#tab3"><span class="stateTab">VIC</span></a></li> 
                    <li><a href="#tab4"><span class="stateTab">SA</span></a></li> 
                    <li><a href="#tab5"><span class="stateTab">WA</span></a></li> 
                    <li><a href="#tab6"><span class="stateTab">ACT</span></a></li> 
                    <li><a href="#tab7"><span class="stateTab">NT</span></a></li> 
                    <li><a href="#tab8"><span class="stateTab">TAS</span></a></li>
                    <li><a href="/leaderboard/australia/"><span class="stateTab">AUSTRALIA</span></a></li>
                </ul> 

So if user clicks #tab2 then a different DIV loads into the div id=”???” .

I think its fairly simple, just cannot figure it out. I realise I possibly have to set all the divs up, like so:

<div id="tab1"> content goes here </div>
<div id="tab2"> content goes here </div>
<div id="tab2"> content goes here </div>

And set visibility hidden to the divs.. any help appreciated.

*** ADDED INFO *******

The tabs, onclick ( presently ) display content from dataTables.
So obviously when we click on tab1, the content below the tabs , shows the content fetched from our dataTables, in a div with id1

The issue now is, with wanting to change the content ABOVE the tabs aswell as the content BELOW the tabs… the 2 id’s are conflicting, and one shows and one hides…

The TABS also change content below them, presumably we need to chain the id actions somehow, to get two sets of content to change in harmony

  • 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-05-23T21:08:23+00:00Added an answer on May 23, 2026 at 9:08 pm

    Set it up the way you planned in HTML adding style=”display: none” to each div except the one you want to show by default. Then add to you javascript (at the bottom, or in $(function(){ //Document ready });

    $('.tabs a').click(function(){
            $('div[id^=tab]').hide();
            $(this.href).show();
            return false;
        }
    );
    

    As for your Update, you can change your divs to have a class instead of an id. Like
    Content Above 1
    Content Above 2

    Tabs

     <div class="tab1 tabContent">Content Below 1</div>
     <div class="tab2 tabContent">Content Below 2</div>
    

    Then you can change the javascript:

    $('.tabs a').click(function(){
            $('div.tabContent').hide();
            $('div.'+this.href).show();
            return false;
        }
    );
    

    You’ll also need to remove the hashes from your anchors, so the href becomes “tab1” instead of “#tab1”

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Doing some code in JavaScript/jQuery and I need to have it where the user
doing a simple login for my website, which will hopefully keep the user logged
Doing Android development on a Mac and this very new phone I have doesn't
Doing an ajax get request works as expected using the following code: $.ajax({ type:
Doing the below will reproduce my problem: New WPF Project Add ListView Name the
Doing some jquery animation. I have certain divs set up with an attribute of
Doing something like this: from zipfile import ZipFile #open zip file zipfile = ZipFile('Photo.zip')
doing this in AppDelegate: viewController = [[RootViewController alloc] initWithNibName:nil bundle:nil]; Is there any problem
Doing this: var _partsCatalog = new DirectoryCatalog(directoryName);//Fully qualified path to our bin folder var
Doing a top shows this top - 22:04:27 up 7:47, 3 users, load average:

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.