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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T08:55:45+00:00 2026-05-14T08:55:45+00:00

My issue is simple. I have already implemented a tab system, and I’d probably

  • 0

My issue is simple.

I have already implemented a tab system, and I’d probably spend more time implementing another one with the solution I need, than giving a shot at adapting the code I have, and learn something while asking 🙂

My problem is that the tabs can’t be linked to, I need to be able to link to a tab from another website or page, and have that tab get selected upon page load.

ie: I have three tabs showing different products, by default tab 1 is active/selected when the page loads. From the home page I want to link to tab 2 but I can’t link to tab 2 because it doesn’t get selected. Not sure if that makes sense.

Tabs:

 <ul>
  <li><a href="#tab1">Product 1</a></li>
  <li><a href="#tab2">Product 2</a></li>
  <li><a href="#tab3">Product 3</a></li> 
 </ul>

 <div class="tab_container">
  <div id="tab1" class="tab_content">Product 1 info...</div>
  <div id="tab2" class="tab_content">Product 2 info...</div>
  <div id="tab3" class="tab_content">Product 3 info...</div>
 </div>

my jQuery:

$(document).ready(function() {

//Default Action
$(".tab_content").hide(); 
$("ul.tabs li:first").addClass("active").show(); 
$(".tab_content:first").show(); 

//On Click Event
$("ul.tabs li").click(function() {
    $("ul.tabs li").removeClass("active"); 
    $(this).addClass("active"); 
    $(".tab_content").hide(); 
    var activeTab = $(this).find("a").attr("href");
    $(activeTab).fadeIn(); 
    return false;
  });

});

Is there a way this code can be adapted to be able to link to any tab from anywhere and have that tab get selected when the page loads?

Thanks in advance.

  • 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-14T08:55:46+00:00Added an answer on May 14, 2026 at 8:55 am

    Your tabs would be more usable like this:

     <ul>
      <li><a href="#tab1">Product 1</a></li>
      <li><a href="#tab2">Product 2</a></li>
      <li><a href="#tab3">Product 3</a></li> 
     </ul>
    
     <div class="tab_container">
      <div id="tab1" class="tab_content">Product 1 info...</div>
      <div id="tab2" class="tab_content">Product 2 info...</div>
      <div id="tab3" class="tab_content">Product 3 info...</div>
     </div>
    

    So that you are now able to look for a hash in the URL of the browser (e.g. use location.pathname to extract the URL hash and use the $.tabs().select([id] or [index]) to set the tab).

    For example

    $(function(){
       $('tabs').tabs();
       var hash = location.hash;
       $('tabs').tabs( "select" , hash );
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm just learning nHibernate and have come across what probably is a simple issue
I have simple issue setting a two-way databinding of a checkbox in Silverlight 3.0.
I have a simple issue, but the solution appears to be tricky. I want
I have a simple issue -- I would like to check a field to
I have what should be a simple issue: On my newest rendition of http://www.derekbeck.com/1775
Yall: I have a simple question, it might be a simple configuration issue, but
This should be a simple issue but I can't figure this out. I have
I have a very large ASP.NET application in C#. The issue is simple yet
I have a simple XML extraction issue that should be solvable with straight PHP
I have a simple page here to demonstrate the issue that I am seeing.

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.