Click here to Skip to main content
15,886,919 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I am trying to open a jquery ui dialog box from an iframe. When the button is clicked to open the dialog box, the dialog box is suppose to display over the iframe like a bootstrap modal.

The problem I am having is when I click a button to open the dialog box it opens the entire page of the other file inside the dialog box.

What I have tried:

myIframeFile.asp:

<iframe id="myiframe" src="myFileToOpenTheDialogBox.asp?a=<%=Request.QueryString("a")%>"></iframe>


myFileToOpenTheDialogBox.asp:


<button id="btnOptions">Options</button>

<div id="dialog" title="Options" style="display:none;">
<form>
...
</form>
</div>

<script>

JavaScript
$(document).ready(function(){
      $("#btnOptions").click(function(){
         $("#myiframe", window.parent.document).dialog({
            width:800,
            resizable: true
         });
      });
    });

</script>
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900