I have tried some method from web about changing the jQuery dialog title but I haven't succeed. Would someone help me how to do it. Thanks in advance
I have many existed popup page that using window.showModalDialog method to open. Now I need to change jQuery dialog box. I wanted to change the dialog box title depend on the popup page title. Now the popup page is in iframe and the iframe is inside the jQuery dialog. I add the function to change the title in popup page.
Here is my aspx page:
<div id="dialog">
<iframe id="myIframe" src=""></iframe>
</div>
<button id="dialogBtn">Open Dialog</button>
The javascript to handle the dialog:
$("#dialog").dialog({
autoOpen: false,
modal: true,
height: 600,
open: function(ev, ui) {
$('#myIframe').attr('src','http:Order/orderForm.aspx');
}
});
$('#dialogBtn').click(function() {
$('#dialog').dialog('open');
});
There is the function to change the title on popup page onload method:
function changeDialogTitle() {
var dialog = $('#dialog', parent.document);
alert(dialog.length);
$('#dialog', parent.document).dialog({ title: "New Dialog Title" });
}
I also tried this to reopen the dialog box but failed:
$('#dialog', parent.document).dialog("option", "title", "New Title").dialog('open');