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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T21:28:13+00:00 2026-05-22T21:28:13+00:00

Scenario I have a Dialog created by jquery UI dialog. It opens on a

  • 0

Scenario
I have a Dialog created by jquery UI dialog.
It opens on a click with a form, form is submitted on a click.
Feedback appears below the form announcing success. Before closing the dialog I want to remove the success message so that it doesn’t appear the next time the dialog/form opens. Note: Its likely that the dialog/form will be opened several times without reloading the page.
The process works up to the point of removing the success message.

My Attempted Solution
I added the following line to my dialog script. I believe the syntax is correct but adding this line breaks the script.

beforeClose: function (event ui) {
    $("div#output1").empty();
                      },

Full Dialog Script

$(document).ready(function() {
$('#target a').each(function() {
    var cancel = function() {
        $dialog.dialog('close');
    };
    var $link = $(this);
    var $dialog = $('<div></div>')
        .load($link.attr('href'))
        .dialog({
            autoOpen: false,
            title: $link.attr('title'),
            width: 700,
            height: 800,
            modal:  true,
            buttons: { "Ok": cancel, "Cancel": cancel},
            beforeClose: function (event ui) {
                $("div#output1").empty();
        },
            open:   function (event,ui) {
                $("input[name='url']").val(pageAddress);
                }
        });

    $link.click(function() {
        $dialog.dialog('open');
        $( "#accordion" ).accordion({
            collapsible: true,
            active: false
        });
        return false;
    });
    });
});

Looking at other examples I appear to have the structure of the statement correct but I’d appreciate any pointers as to why this approach breaks my script.

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-22T21:28:13+00:00Added an answer on May 22, 2026 at 9:28 pm

    You got invalid syntax there. Add the comma between event and ui in beforeClose: function (event ui) {

    beforeClose: function (event, ui) {
        $("div#output1").empty();
                          },
    

    working fine: http://jsfiddle.net/niklasvh/8DD9L/

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

Sidebar

Related Questions

Scenario: Using jquery form plugin . The form appears in a dialog, created with
Scenario: I have a document I created using LaTeX (my resume in this case),
I have the following scenario I have a main form as MDI parent and
I'm having some trouble with IE6 and jQuery UI. I have a popup dialog
here's how my scenario is created. I click a button which produces a pdf
I have two 'nested' or 'cascaded' dialogs on my web page (one dialog opens
Here is my scenario: I have a windows form designed in Visual Studio 2010.
Ok, i have simple scenario: have two pages: login and welcome pages. im using
Scenario: You have an ASP.Net webpage that should display the next image in a
Scenario I have two wrappers around Microsoft Office, one for 2003 and one for

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.