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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T07:18:34+00:00 2026-06-04T07:18:34+00:00

When i click on a link in my page, i am opening a jquery

  • 0

When i click on a link in my page, i am opening a jquery dialog box (if it is not already open) and adding a jquery ui tab inside it. Followed example from here

But when i close my jquery dialog and reopen it, the tabs which were opened previously are showing up. I would like to have no tabs inside the jquery dialog, when i close and reopen the dialog, so that i can add a new tab inside the dialog.

This is the code that is present in my jquery document ready:

<script type="text/javascript">
var tab_counter = 1;

$(document).ready(function() {
var $tabs_example_1 = $('#example_1').tabs();

$('#addUiTab').click(function(){
        var label = 'Tab'+tab_counter,
        content = '<span id="tab">This is a sample tab content</span>';

        $('body').append('<div id="tab_'+tab_counter+'">'+content+'</div>');
        $tabs_example_1.tabs('add','#tab_'+tab_counter,label);
        tab_counter++;

        return false;
    });
});
</script>

This is my function that opens a dialog box (if it is not already open) and adds a tab inside it, when i click on a link in my page:

function open_dialog()
{
    if(($("#jdialog_box_content").dialog( "isOpen" ) === true) == false)
    {
        $('#jdialog_box_content').dialog({
        open: function(event, ui) {  },
        close: function(event, ui) {  },
        autoResize: false,
        width: 460,
        height: 230,
        closeOnEscape: false,
        title: 'Dialog1'
        });
    }

    $('#addUiTab').trigger("click");
}

And finally this is the html that is used for the jquery tabs, inside jquery dialog box:

<div id="jdialog_box_content" style="display:none;">    
    <div id="example_1" class="tabs">
        <ul>
            <li><a href="#tabs-1-2">Tab 1</a></li>
            <li><a href="#tabs-2-2">This is tab 2</a></li>
            <li><a href="#tabs-3-2">This is tab number 3</a></li>           
        </ul>
        <div id="tabs-1-2">Tab 1<br>Lorem ipsum dolor sit amet</div>
        <div id="tabs-2-2">This is tab 2<br>Lorem ipsum dolor sit amet</div>
        <div id="tabs-3-2">This is tab 3<br>Lorem ipsum dolor sit amet</div>
    </div>
</div>

I am just curious to know how can i remove the existing tabs in my jquery dialog box, when it is reopened.

Note: I am following the example at this site for jquery ui tabs.

  • 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-04T07:18:35+00:00Added an answer on June 4, 2026 at 7:18 am

    You need close: function(event, ui) { $("#jdialog_box_content").html(""); } in your dialog declaration.
    if you don’t need empty dialog and just no tabs you can do so by that:

    $('#jdialog_box_content').dialog({
            open: function(event, ui) {  },
            close: function(event, ui) {
                var $tabs = $('#example_1');
                var l = $tabs.tabs('length');
                while(l)
                {
                   $tabs.tabs('remove', l-1);                       
                   l = $tabs.tabs('length');
                }
    
            },
            autoResize: false,
            width: 460,
            height: 230,
            closeOnEscape: false,
            title: 'Dialog1'
            });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hello everyone iam trying to open a aspx page in a dialog box window
I need to allow a user to click a link in page-1.htm and open
Why when I click a link in the page loaded in the WebView in
I click on a link from one page that does a redirect to another
When a user click a link, it would redirect them to a page, something
Please visit this link Click on first Image. Now is showing the Modal page
I have some textboxes on a page and I want to click a link
This code works perfectly except when you click on a link, The page is
Is there a way of making a jQuery dialog opening in the center of
I want to show a popup screen on my page using JQuery UI Dialog

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.