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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T15:00:48+00:00 2026-05-16T15:00:48+00:00

I have a form and a div within that form that I am using

  • 0

I have a form and a div within that form that I am using for the contents of a jQuery dialog. My goal is to have the dialog pop up, the user enters some information in the text boxes and textareas there, then submit the form and have that data available to my code behind, but then be able to re-open the dialog (the page stays up after submit), enter new data, and resubmit the form if they wish.

If I run:

$('div#mydialog').appendTo($('form#foo'));

and then:

 $('div#mydialog').dialog('open');

a dialog shows up with only the buttons, and behind it the div is being shown, inaccessible to the user. (in short, it looks like a cluster-intercourse of UI widgets)

Why is it that appending div#mydialog to the form (which is where it was to begin with) and then calling .dialog(‘open’) results in such behavior, and how can I get it to open normally after having appended it to form#foo to send the user’s data to the server?

Thanks in advance

EDIT: it appears that for some reason the dialog is not being appended to after it is initially opened. i.e. it gets opened/edited/closed some number of times, user clicks “submit”, div is appended to form, then when I try to dialog(‘open’) again, Firebug shows that it is staying put right where it is in the form – jQuery appears not to try to move it again, instead just changing its inline styles. Does anyone know why this is so?

EDIT 2: I don’t know how much of my html/script will help you, it’s basically just what you would imagine it is:

    <form id="foo"><! -- some form stuff -->
  <div id="stufftoputindialog" style="display:none;">
    <!-- text boxes/textareas to put in dialog -->
  </div>
</form>

and

    $('#stufftoputindialog').dialog({
            height: 550,
            width: 400,
            modal: true,
            buttons: {
                "OK": function () { $(this).dialog("close"); },
                "Cancel": function () { $(this).dialog("close"); }
            },
            autoOpen: false
        }

on click of edit button:

   $('#stufftoputindialog').dialog('open');

on submit of form:

$('#stufftoputindialog').appendTo('form#foo');

then on click of edit button again,

$('#stufftoputindialog').dialog('open');

causes a UI trainwreck (and according to Firebug, #stufftoputindialog hasn’t moved outside of the form to right before </body> like it did the first time)

  • 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-16T15:00:48+00:00Added an answer on May 16, 2026 at 3:00 pm

    It’s in a container you need to move as well, do this instead:

    $('div#mydialog').parent().appendTo('form#foo');
    

    The wrapper is for things like the titlebar…look at your source, when you call .dialog() it’s wrapping it inside another <div>, you need to go to that .parent() then move that element 🙂

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

Sidebar

Related Questions

I have a page that is using jQuery tabs. Within one of my tabs
I have an ASP.NET page that has three div s within the only form
If I have a HTML form with some embedded div s, and after the
I have a basic HTML form that gets inserted into a server side div
I have a form with some radio buttons that are disabled by default. When
I have a YUI dialog that submits a form to a Java servlet. The
I have form that displays several keywords (standard set of choice lists that changes
I have a form in C# that has a button that, when clicked, I
I have subclassed Form to include some extra functionality, which boils down to a
I am trying to make a form with some dynamic behavior. Specifically, I have

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.