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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T00:19:00+00:00 2026-06-05T00:19:00+00:00

I have 2 pages, say page1.html and page2.html. page1.html has this code: $(document).ready(function() {

  • 0

I have 2 pages, say page1.html and page2.html.

page1.html has this code:

$(document).ready(function() {
                   $('#mydialog').dialog({autoOpen : false, modal : true});
                   $('#myopenlink').click(function() {
                                             $('#mydialog').load('page2.html');
                                             $('#mydialog').dialog('open');
                                             return false;
                                           });                                 
                   });

The relevant HTML elements in page1.html:

<a href="#" id="myopenlink"> Open </a>
<div id="mydialog"> </div>

when I click “myopenlink”, I’ll get a modal dialog displaying page2.html.

Now, in page2.html, I have another link (or a submit button etc..). I want to close the dialog once it’s clicked (i.e. close the dialog from within the page it loaded).

Is this possible?

EDIT:

After some digging I guess my question isn’t about dialog box specifically. This is what I’m trying to do:

page2.html content:

<a href="#" id="mycloselink"> close </a>

page1.html content:

function closeLinkClicked(event) {
    event.preventDefault();
    alert('Please Reach this point so I replace this with close dialog');
}

function doneLoading(data) {
    $('#mydiv').on('click', '#mycloselink', closeLinkClicked);
}

$(document).ready(function() {
                             $('#mydiv').load('page2.html', doneLoading);
                            });

page1.html also has this of course:

<div id="mydiv"> </div>

When I click the link which was loaded from page2 into the mydiv, nothing happens (I expect the alert to show).

What am I doing wrong?

Thanks
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-06-05T00:19:02+00:00Added an answer on June 5, 2026 at 12:19 am

    Hiya like this demo http://jsfiddle.net/mhLc5/6/ OR Updated Answer => this http://jsfiddle.net/Pb2eR/ or http://jsfiddle.net/Pb2eR/1/

    Dynamic Append Demo: http://jsfiddle.net/Pb2eR/13/

    SO to close the dialog you just need to call .dialog('close') rest a demo will give you a good place to play around.

    APIs reside here: http://jqueryui.com/demos/dialog/

    good read: http://forum.jquery.com/topic/close-a-jquery-ui-dialog-from-the-inside

    Hope this helps!

    code

     buttons: {
    
                'Submit': function() {
                    $Dialog_div.dialog('close');
                }
    

    Rest of the sample code

    var $Dialog_div;

    function fnOpenDialog() {
        $Dialog_div = $('<div id=\'ThisDialog\'>Hello Page 2</div>').prependTo('body');
    
        $Dialog_div = $('#ThisDialog').dialog({
            autoOpen: true,
            draggable: true,
            resizable: true,
            title: 'Dialog stack overflow HULK',
            modal: true,
            stack: true,
            height: ($(window).height() * 0.95),
            width: ($(window).width() * 0.9),
    
            buttons: {
    
                'Submit': function() {
                    $Dialog_div.dialog('close');
                }
    
            }
    
        });
    
    }
    
    $('#ClickMe').click(fnOpenDialog);​
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Lets say i have this javascript code in an html pages <script type=text/javascript> $(document).ready(function(){
lets say i have two pages links.html & contents.php ... first page contains only
I have 5 pages - for ease lets say: one.html two.html three.html four.html five.html
Lets say there are two pages with two different html elements which have the
Let's say I have this HTML markup on an aspx page: <div id =
I have html page say abc.htm it has 2 anchors which are pointing to
Well lets say I have this follow code in my htaccess file, Options +FollowSymlinks
I have 3 buttons in my html page, say ADD , UPDATE & DELETE
Let's say we have two flash objects on the same html page. I want
i know i can have iframe in a html page, say parent.htm, and i

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.