Note that there are some explanatory texts on larger screens.

plurals
  1. POClosing a Jquery UI dialog from inside
    primarykey
    data
    text
    <p>I have 2 pages, say page1.html and page2.html.</p> <p>page1.html has this code:</p> <pre><code>$(document).ready(function() { $('#mydialog').dialog({autoOpen : false, modal : true}); $('#myopenlink').click(function() { $('#mydialog').load('page2.html'); $('#mydialog').dialog('open'); return false; }); }); </code></pre> <p>The relevant HTML elements in page1.html: </p> <pre><code>&lt;a href="#" id="myopenlink"&gt; Open &lt;/a&gt; &lt;div id="mydialog"&gt; &lt;/div&gt; </code></pre> <p>when I click "myopenlink", I'll get a modal dialog displaying page2.html.</p> <p>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).</p> <p>Is this possible?</p> <p><strong>EDIT:</strong></p> <p>After some digging I guess my question isn't about dialog box specifically. This is what I'm trying to do:</p> <p>page2.html content:</p> <pre><code>&lt;a href="#" id="mycloselink"&gt; close &lt;/a&gt; </code></pre> <p>page1.html content:</p> <pre><code>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); }); </code></pre> <p>page1.html also has this of course:</p> <pre><code>&lt;div id="mydiv"&gt; &lt;/div&gt; </code></pre> <p>When I click the link which was loaded from page2 into the mydiv, nothing happens (I expect the alert to show).</p> <p>What am I doing wrong?</p> <p>Thanks Thanks</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload