I have the following problem. I'm trying to add dynamic buttons in a modal dialog with iframe. I have Iframe dialog box with standard buttons (like close, ok..). After new content is loaded by iframe url scr attribute, i need dynamic add new button, for example "register". My code:
var iDlg= $('<iframe src=price.php?code="'+uCode+'" frameborder="0" />').dialog({
modal: true,
dialogClass: 'priceBox',
title: 'Detail',
height: 400,
width: 500,
draggable: false,
resizable: false,
//show: "fade",
buttons: {
"close": function() {
$( this ).dialog( "close" );
}
}
}).width(480);
source of price.php:
<script type="text/javascript">
$(document).ready(function(){
var opt = {
buttons: {
'New button...': function () {
$(this).dialog('close');
}
}
};
$(iDlg).dialog('option', opt);
});
</script>
But, this solution doesn't work. Please help. Thanks.
.iDlginstead ofiDlg. Also, is that variable accessible from where you use it?iDlgis not defined (error in price.php)