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

The Archive Base Latest Questions

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

Hi i am having a little trouble with my jquery tabs, for some reason

  • 0

Hi i am having a little trouble with my jquery tabs, for some reason it loads the first tab content, but when i select another tab the content is not displayed. When i try to go back to the first tab it doesnt load either.

Here is the html

JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
<div id="content">
<div id="tabsX">
  <div id="tabContent">
  <ul class="tabs">
    <li><a id="all" href="#all" class="all">All</a></li>
    <li><a id="free" href="#free" class="free">Free</a></li>
    <li><a id="paid" href="#paid" class="paid">Paid</a></li>
    <li><a id="completed" href="#completed" class="completed">Completed</a></li>

    <div id="filter"><select name="filterQuest">
      <option>Name</option>
      <option>Payout</option>
      <option>Difficulty</option>
    </select></div>
  </ul>


<div class="tab_container">
    <div id="all" class="tab_content">
        asddd
    </div>
    <div id="free" class="tab_content">
       <!--Content-->adadada
    </div>
    <div id="paid" class="tab_content">
       <!--Content-->adad
    </div>
    <div id="completed" class="tab_content">
       <!--Content-->adsasd
    </div>

</div><!--- end tab_container--->
  </div><!---end tab content--->
  <br class="clear" />
</div><!--- end tabsX--->
<div id="tournament"></div><!--- end tournament--->
</div><!--- end content--->

Here is the javascript

JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
<script type="text/javascript"
src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js"></script>
<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 css

JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
@charset "utf-8";
/* CSS Document */

ul.tabs {
    padding: 0;
    float: left;
    list-style: none;
    height: 56px;
    width: 100%;
    margin-top: 0;
    margin-right: 0;
    margin-bottom: 0;
    margin-left: 0;
    border-bottom-width: 1px;
    border-bottom-style: ridge;
    border-bottom-color: #999;
    position:relative;


}
#tabsX {
    width: 800px;
    padding-left: 20px;
    float: left;
}
#tabsX .clear {
    clear: both;
}



ul.tabs li {
    float: left;
    padding: 0;
    height: 55px;
    line-height: 53px;
    margin-bottom: -1px;
    overflow: hidden;
    position: relative;
    margin-top: 0px;
    margin-right: 20px;
    margin-left: 0;
    font-family: Georgia, "Times New Roman", Times, serif;
    font-size: 12px;


}
ul.tabs li a {
    text-decoration: none;
    color: #333;
    display: block;
    font-size: 1.2em;
    padding: 0 20px;
    outline: none;
    position:relative;

}
/*ul.tabs li a:hover {
    color: #9C3;
    text-transform: none;
}*/
html ul.tabs li.active a.all,
ul.tabs li  a.all:hover {
    color: #999;
    text-transform: none;
    border-bottom-width: thick;
    border-bottom-style: ridge;
    border-bottom-color: #999;
}
html ul.tabs li.active a.free,
ul.tabs li  a.free:hover {
    color: #7ED200;
    text-transform: none;
    border-bottom-width: thick;
    border-bottom-style: ridge;
    border-bottom-color: #7ED200;
}   
html ul.tabs li.active a.paid,
ul.tabs li  a.paid:hover {
    color: #CB0C01;
    text-transform: none;
    border-bottom-width: thick;
    border-bottom-style: ridge;
    border-bottom-color: #E40D01;   
}
html ul.tabs li.active a.completed,     
ul.tabs li  a.completed:hover {
    color: #06C;
    text-transform: none;
    border-bottom-width: thick;
    border-bottom-style: ridge;
    border-bottom-color: #06C;
}

.tab_container {
    clear: both;
    /*float: left;*/
    width: 100%;
    border-right: 1px ridge #999;
    margin-bottom: 20px;
    min-height: 930px;

}
.tab_content {
    padding: 20px;
}

.tab_content img {
    float: left;
    margin: 0 20px 20px 0;
    border: 1px solid #ddd;
    padding: 5px;
}
#tabContent #filter {
    float: right;
    margin-top: 17px;
    margin-right: 50px;
}
  • 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-26T19:01:20+00:00Added an answer on May 26, 2026 at 7:01 pm

    First, HTML ID attributes must be unique. In your example, several elements have the same ID, which is wrong (both for XHTML validation and for JS – this leads to bugs).

    Second, have you used a debugger to see what $(this) contains when you click on a link?

    Lastly, does the “class-switching” stuff works? We need you to provide more information 🙂

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

Sidebar

Related Questions

I'm having some trouble writing a jQuery function and could use a little help.
I'm making an image scroller with jQuery but I'm having a little trouble. I've
Ok, so I recently started learning jQuery, but I'm having trouble with a little
I am having some trouble with the jquery isotope plugin, for some reason it
I'm having a little trouble getting Jquery to play nice with cakephp and I'm
Question: I'm having a little trouble with jQuery: Consider this HTML, where I want
Having a little trouble with jQuery, please help. I need to grab the contents
I'm having a little trouble using jQuery in Rails. I'd like to call the
I'm having a little trouble with JQuery autocomplete remote-cache and Zend, it doesn't work
I'm having a little trouble with a jQuery plugin wrote. I've got it working

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.