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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T13:16:36+00:00 2026-05-26T13:16:36+00:00

I have 7 jquery ui tabs on a jspx page. I dynamically add a

  • 0

I have 7 jquery ui tabs on a jspx page. I dynamically add a new tab to render search results from a search form. So far, so good. Now when the user clicks on any of the other tabs, the newly created tab for “Search Results” must be removed. This is where my problem begins.

                $('#tabs').tabs({
                    select : function(event, ui) { //bind click event to link                   
                        selectedIndex = ui.index;

                        if ((selectedIndex < 8) && ($('#tabs').tabs("length") > 8)) {
                            $('#tabs').tabs('remove',8);
                        }

                         //I have other stuff here for each of the original 7 tabs
                 });

It seems that this tab is only deletable after I re-initialize the tabs like

$('#tabs').tabs('destroy').tabs();
$('#tabs').tabs('remove',8);

But I have a data grid on my page which is dynamically added to the system of tabs based on the tab index being clicked. If I destroy and then remove, my grid disappears completely form all other tabs(removed from the dom) which is not what I want.

Please help, thanks.

  • 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-26T13:16:36+00:00Added an answer on May 26, 2026 at 1:16 pm

    The problem is that you are trying remove the currently displayed tab. Since this event fires before the change in tab has really occurred, you are essentially pulling the rug out from under yourself. From the UI source:

    select: function( index ) {
        index = this._getIndex( index );
        if ( index == -1 ) {
            if ( this.options.collapsible && this.options.selected != -1 ) {
                index = this.options.selected;
            } else {
                return this;
            }
        }
        this.anchors.eq( index ).trigger( this.options.event + ".tabs" );//YOUR EVENT
        return this;
    },
    

    If you want to delete a tab you’ll have to be careful “when” this occurs. Your code works fine when hooked into “show”.

    show: function(event, ui) { //bind click event to link                   
                    selectedIndex = ui.index;
    
                    if ((selectedIndex < 2) && ($('#tabs').tabs("length") > 2)) {
                        $('#tabs').tabs('remove',2);
                    }
                }
    

    jsfiddle

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

Sidebar

Related Questions

Suppose i have some tabs (e.g. jquery tab) and I want to dynamically load
I have group of jQuery Tabs that are created dynamically. Each tab has an
I have an aspx page on which I have 2 static jquery tabs.Upon clicking
I have a page that is using jQuery tabs. Within one of my tabs
I have different php output in jQuery-based tabs. This output is formed from database
I have a fairly complex html form enhanced via jquery. It has multiple tabs,
I have some jquery tabs on my page the code for them is: //tabs
I have an asp.net page with some JQuery tabs. Everything works ok. I added
I have a page containing a set of jQuery tabs. All the tabs point
I have jquery tabs, in which one tab has an iframe and the other

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.