fes
fes

Reputation: 2515

iframe jquery dialog in parent window

I have a page with an iframe that appears in a jQuery dialog.

Inside the iframe it loads a page and there is a button on that page which shows an alert via a jQuery dialog. At the moment the dialog appears and sits over the iframe, however how can I display this dialog to appear outside of the iframe and be at the upper most layer? i.e. covers the parent screen.

main page

<div><iframe src="" id="theframe" name="theframe"></iframe></div>

iframe page is loaded dynamically and on that page there is a function

$('#alertclick').click(function() {
    var alert_dialog = $('<div>' + alertinfo + '</div>');
    alert_dialog.dialog({ width: 400, height: 300, resizable: false });
});

Upvotes: 1

Views: 2909

Answers (1)

Ashley
Ashley

Reputation: 1489

If you put the div in the parent page, you can call a function within the parent page to show the dialog from inside the iframe. For example, placing this within the iframe:

parent.functionName();

Will call the function functionName within the initial page, from the iframe.

Upvotes: 1

Related Questions