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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T12:22:52+00:00 2026-05-18T12:22:52+00:00

I have group of jQuery Tabs that are created dynamically. Each tab has an

  • 0

I have group of jQuery Tabs that are created dynamically. Each tab has an iFrame with it. Here is a stripped down version of the code:

$tabs = $('#myTabs').tabs({
    tabTemplate: '<li class="myTabClass"><a href="#{href}">#{label}</a> <span class="ui-icon ui-icon-close">Remove Tab</span></li>',
    add: function (event, ui) {
      $(ui.tab.hash).append('<iframe src="BlankTabHTML.htm" id="tabFrame' + GLOBALTabIndex + '" class="tabIFrames" frameBorder="no"></iframe>');
    },
    remove: function (event, ui) {
      GLOBALTabIndex --;
    }
  });

My problem is this: When a user clicks the ‘x’ to remove a tab, the tab and iFrame are removed but onbeforeunload isn’t fired.

I to unload the iframe by setting the frame to a dummy page, then find out if the user clicks “ok” or “cancel” on the onbeforeunload dialog so I know if the tab should be closed.

If they click cancel I need to cancel the tab removal. I have looked through jQuery’s documentation and can’t seem to find a way to cancel the tab removal once it is called. I know this is really a couple questions in one, any ideas?

  • 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-18T12:22:52+00:00Added an answer on May 18, 2026 at 12:22 pm

    Don’t call tab().remove() directly by clicking on the span.

    Just remove the iframe as you said(changing the src).

    First onbeforeunload will fire. Later, if the user chooses “yes”, onunload will fire, where you can remove the tab too.(There is no way to determine directly, what the user chooses in beforeunload, you have to observe unload, it’s clear that the user chooses “yes” if onunload fires)

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

Sidebar

Related Questions

I have created an interface using jQuery UI Tabs, however one of my requirements
I have a group of tabs that have hidden content which display when the
I have a group of checkboxes that I only want to allow a set
I have a domain and a group of sub-domains that require authentication to access.
I'm using the jquery tabs plugin and want to have the background a light
I have group of radio buttons that I want to uncheck after an AJAX
I'd like to have a group of HTML text <input> 's that can be
Let's explain the context: I have a person form inside a jquery dialog that
I have 3 different radio button group in jQuery like so: <tr class=toValidate> <td>Please
I have a group of anchor tags that I want to have comma separated.

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.