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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T03:54:26+00:00 2026-06-09T03:54:26+00:00

i have this pretty well known script that i am trying to get working,

  • 0

i have this pretty well known script that i am trying to get working, at the moment it all works great, but when you first open the page it shows the first tab, as it should, what i want is it to show the second tab. (the first is just a mail compose tab, the second is the actual inbox)

Here is the javascript

    <script type="text/javascript">

$(document).ready(function() {

    //Default Action
    $(".tab_content").hide(); //Hide all content
    $("ul.tabs li:first").addClass("active").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 rel attribute value to identify the active tab + content
        $(activeTab).fadeIn(); //Fade in the active content
        return false;
    });

});

</script>

And here is the html for the tabs

> <ul class="tabs">
>     <li><a href="#compose" class="compose"></a></li>
>     <div id="mail_sidebar_top">
>         <li><a href="#inbox" class="inbox">Inbox(0)</a></li>
>         <li><a href="#sent_mail" class="sent_mail">Sent Mail(0)</a></li>
>         <li><a href="#trash" class="trash">Trash(0)</a></li>
>         <li><a href="#reported" class="reported">Reported</a></li>
>         <li><a href="#drafts" class="drafts">Drafts</a></li>
>         
>     </div><!---end mail_sidebar_top--->
>     
>     <div id="mail_sidebar_middle">
>         <li><a href="#notifications" class="notifications">Notifications</a></li>
>         <li><a href="#alerts" class="alerts">Alerts</a></li>
>         
>     </div><!---end mail_sidebar_top--->
>    
>     </ul>

Thanks for any and all help

  • 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-09T03:54:28+00:00Added an answer on June 9, 2026 at 3:54 am

    In order to show the second tab, change these lines

       $("ul.tabs li:eq(1)").addClass("active").show(); //Activate second tab
       $(".tab_content:eq(1)").show(); //Show second tab content
    

    Basically, in your current version, when the page is loaded, you add the active tab content and classes based on a jQuery selector. Because your html content is in the same order as the tabs, rather than using a selector for the first instance, (ie the :first), we can change it to :eq(1). (it’s one in this case, as jquery refers to the DOM elements in an array, so the first tab is at index 0, and the second is at index 1). To show a different tab at start, you would simply change the :eq(1) to :eq(n) where n is the array index of the tab you want.

    EDIT An even better solution is to use the actual eq() function provided by jQuery as it adds a performance boost:

       $("ul.tabs li").eq(1).addClass("active").show(); //Activate second tab
       $(".tab_content").eq(1).show(); //Show second tab content
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

That sounds pretty odd but i have this cod and i need to convert
I have this annoying problem, that Im pretty sure happens to all of you
I do realize that this question seems very well known, but since I don't
I've written an entire app pretty successfully in Django but I have this nagging
I'm a beginner in powershell and know C# pretty well. I have this command
It's pretty well known that the default behaviour of std::bind and std::thread is that
I'm using Vim and editing Python scripts. Autoindent works pretty well in general, but
This should be pretty straightforward I would think. I have this string: [quote=Joe Johnson|1]Hi![/quote]
I have been researching this issue pretty extensively and cannot seem to find an
I have written something like this pretty easily in C# ( string GetUrl(new {

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.