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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T01:29:34+00:00 2026-05-27T01:29:34+00:00

I wonder if we can able to select a particular tab in a JQuery

  • 0

I wonder if we can able to select a particular tab in a JQuery tab system from another page..?

For example I have a 4 menus that is Home | About | Services | Contact
In services page I have a tab system with 5 tabs(Flight, Hotels, International Flight, Rail, Bus) in it, so I’m coming to the point is one who select Bus link from the home page I need to display the Bus tab(default visible one is Flight) in services page.

I have tried to give the bus link in home page like this..
services.php#tab4 (like anchor tag method)

unfortunately it doesn’t work..

Im using the following JQuery for my tab system..

$(document).ready(function() {

    //When page loads...
    $(".tab_content").hide(); //Hide all content
    $("ul.tabs li:first").addClass("active_pr").show(); //Activate first tab
    $(".tab_content:first").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 href attribute value to identify the active tab + content
        $(activeTab).fadeIn(); //Fade in the active ID content
        return false;
    });

});

tab links in services pages given in ul li like below

<ul class="tabs">
        <li><a href="#tab1">Flight</li>
        <li><a href="#tab2">Hotels</a></li>
        <li><a href="#tab3">International Flight</a></li>
        <li><a href="#tab4">Rail</a></li>
        <li><a href="#tab5">Bus</a></li>
</ul>

I hope that someone can answer the above question.

Thanks

Paul

  • 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-27T01:29:34+00:00Added an answer on May 27, 2026 at 1:29 am

    This should be the complete implementation given your new request:

    $(document).ready(function() {
    
        var strHash = document.location.hash;
    
        if (strHash == "") {
    
            // Go to the first tab as long as there's no other tab specified on which
            // to start.
    
            $(".tab_content").hide(); //Hide all content
            $("ul.tabs li:first").addClass("active_pr").show(); //Activate first tab
            $(".tab_content:first").show(); //Show first tab content
    
        } else
            $("a[href='" + strHash + "']").parent().click();
    
        //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 href attribute value to identify the active tab + content
            $(activeTab).fadeIn(); //Fade in the active ID content
            return false;
    
        });
    
    });
    

    The issue was that you were not considering that if there was a tab specified to go to (the document’s hash), you still had that “//When page loads…” area running regardless. You could even shorten the first conditional’s contents from:

        $(".tab_content").hide(); //Hide all content
        $("ul.tabs li:first").addClass("active_pr").show(); //Activate first tab
        $(".tab_content:first").show(); //Show first tab content
    

    to:

        $("ul.tabs li:first").click();
    

    … considering you already have the same basic functionality delineated in the later click event, but that’s up to you. Also, you’re welcome!

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

Sidebar

Related Questions

I wonder if Socket.Select from .Net can return an IList of two or more
wonder whether someone can help me with the following one... I have a struct
I have a USB device that I need to be able to talk to
I wonder whether someone can help me please. I've put together this page, which
I wonder if anyone can help. An HTML div in a page of mine
I wonder how difficult it would be to be able to have a custom
I have an application that I want to be able to configure the connection
I wonder why i can't seem to be able to apply a decimal value
In SQL Server 2005, I have a Product search that looks like: select ProductID,
Soon enough we will have nVidia GTX 300 that would be able to execute

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.