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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T16:19:15+00:00 2026-05-26T16:19:15+00:00

Am trying to create a tabbed interface in which the tabs can be visible

  • 0

Am trying to create a tabbed interface in which the tabs can be visible via url and when clicked.
I have the following jQuery code

$(function() {
        var tabContent = $('.tab-content');
        var tabs = $('.stream-tabs li');
        var urlHash = window.location.hash;

        tabContent.not(hash).addClass('inactive');
        tabs.find('[href=' + hash + ']').addClass('active-tab');

        tabs.click(function() {
            $(this).addClass('active-tab').siblings().removeClass('active-tab');
            tabContent.hide();
            var activeTab = $(this).find("a").attr("href");
            $(activeTab).fadeIn();
            return false;
        });
    });

This is my html markup

<ul class="stream-tabs">
                    <li><a href="#pheed-timeline">Pheed Timeline</a></li>
                    <li><a href="#directed-pheeds">Directed Pheeds</a></li>
                    <li><a href="#favourite-pheeds">Favourite Pheeds</a></li>
                </ul>
        <div class="tab-container">
            <div id="pheed-timeline" class="tab-content active-tab">
           Pheeed Timovmds
            </div>

            <div id="directed-pheeds" class="tab-content inactive">
           Directed pheeds
            </div>

            <div id="favourite-pheeds" class="tab-content inactive">
           favourite pheeds
            </div>
       </div>

When i click on the tab, nothing happens, the url just changes
What am i doing wrong

  • 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-26T16:19:15+00:00Added an answer on May 26, 2026 at 4:19 pm

    I think you’re looking for something like this:

    // get the current url or even the anchor of it
    var path = document.location.toString();
    // save current anchor in "anchor" var
    var anchor = '#' + path.split('#')[1];   
    
    // if no anchor is set, jquery will automatically set it to "undefined"
    if(anchor != '#undefined') {
        // remove the class from the active tab
        $(".active").removeClass("active");  
        // set the active tab to the new one
        $(anchor).parent().addClass("active");
        // this hides the content of all tabs
        $(".tabContent").hide();  
        // show the new content of the clicked tab
        var content_show = $(anchor).attr("title");  
        $("#"+content_show).show();
    }
    

    I hope it’s not too hard to understand. But it should be helpfull for your own code.

    For better understanding, here’s my HTML code:

    <div class="tabs">
        <ul>
            <li class="active"><a href="#" title="tabContent_1" class="tab">{{@lng.settings}}</a></li>
            <li><a href="#members" id="members" title="tabContent_2" class="tab">{{@lng.members}}</a></li>
            <li><a href="#milestones" id="milestones" title="tabContent_3" class="tab">{{@lng.milestones}}</a></li>
            <li><a href="#roles" id="roles" title="tabContent_4" class="tab">{{@lng.roles}}</a></li>
            <li><a href="#categories" id="categories" title="tabContent_5" class="tab">{{@lng.categories}}</a></li>
        </ul>
    </div>
    
    <div class="tabContent" id="tabContent_1">
    <!-- content here -->
    </div>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to create something that would have the looks of a tabbed interface
I'm trying to create something like a MDI tabbed Interface so I have a
I'm trying create a bot which automatically likes Facebook posts. Using Mechanize I can
I am trying create a data.frame from which to create a graph. I have
a couple of queries with jquery... I'm trying to create a tabbed panel, initially
I am trying create system in which I can login from php and then
I'm trying to create a tabbed sidebar with sections, like the following in WPF.
Trying to create a QtRuby application, I get the following error: /usr/lib64/ruby/site_ruby/1.8/Qt/qtruby4.rb:2144: [BUG] Segmentation
Trying to create a list to return some JSON data to a view. Following
I'm trying create a RCP Application with Eclipse, but I can't get past the

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.