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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T17:07:10+00:00 2026-06-10T17:07:10+00:00

I am using jquery_ui tabs, and my tabs look something like this: <div id=mytabs>

  • 0

I am using jquery_ui tabs, and my tabs look something like this:

<div id="mytabs">
  <ul>
    <li class="tab-one"><a href="#onepane">apples</a></li>
    <li class="tab-two"><a href="#twopane">berries</a></li>
    <li class="tab-three"><a href="#threepane">citrus</a></li>
  </ul>
  <div id="onepane">green apples, red apples</div>
  <div id="twopane">blueberries, raspberries </div>
  <div id="threepane"></div>
</div>

My question:

As the tab content changes, I would like to dynamically hide any empty tabs. In the example above, I would like to hide the third tab, “citrus”, because its corresponding tab-pane contains no content. Does anyone know how to do this?

  • 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-10T17:07:12+00:00Added an answer on June 10, 2026 at 5:07 pm

    This approach, suggested by Nate, did not quite meet my needs, and I ended up implementing the following solution. The code below gets triggered when the user takes an action that changes the content of some tab. The code checks whether any of the tabs are now empty, and if so hides the empty tabs. In addition, it checks whether the selected tab is now hidden, and if so changes the selected tab to the first visible tab.

    var mytabs = $('div#mytabs');
    var selected = mytabs.tabs('option', 'selected'); // index of selected tab
    mytabs.children('ul').children('li').children('a').each(function(index, elem) {
        if (mytabs.children($(elem).attr('href')).html().trim() === ''){
            $(elem).parent().hide(); // hide the 'li' tab-element
        } else {
            $(elem).parent().show(); // show the 'li' tab-element
        }
    }); 
    // if selected tab is now hidden, select the first visible tab
    if (mytabs.children('ul').children('li').eq(selected).is(':hidden')){
        mytabs.children('ul').children('li').each(function(index, elem) {
            if ($(elem).is(':visible')){
                mytabs.tabs('select', index); // select this tab
                return false; // break
            }
        }); 
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using jQuery UI Tabs . <div id=tabs> <ul id=tablist> <li><a href=#fragment-1><span>One</span></a></li> </ul>
Using jQuery's UI Tabs. This is my code. <div id=tabs> <ul> <li><a href=#tabs-1>Find a
I am using jquery UI tabs I have three ajax tabs like so: <div
I'm using JQuery UI tabs with cookie like this. jQuery(document).ready(function() { jQuery(#tabs).tabs({cookie: { expires:
I'm using jQuery UI tabs for simple tab navigation on a page, and this
I'm using JQuery UI tabs loading content via ajax like this: $('#tabsElem').tabs({ajaxOptions:{cache:false}, cache:true); Consider
I am using jquery ui tabs Inside a tab i want to inset an
using jquery ui tabs , when you load a tab in ajax, the tab
I am using Jquery UI Tabs for my website. <script type='text/javascript'> //<![CDATA[ jQuery(window).load(function(){ jQuery('#myTabs').tabs({
I am using JQuery UI tabs , to get the current selected tab i

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.