Jquery UI modal dialogs
- by Anonymous user
Hi All.
I have a problem with Jquery UI modal dialogs. I have modal dialog (dialogA), which can create another modal dialog (dialogB). After the second creation and closure of the dialogB the overlay of dialogA disappear.
Here is my code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head><link type="text/css" rel="Stylesheet" href="ui-lightness/jquery-ui-1.8.custom.css" />
<script type="text/javascript" src="jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="jquery-ui-1.8.custom.min.js"></script>
<script type="text/javascript">
function createDialog(dialogId) {
$('#' + dialogId).dialog({
autoOpen: true,
modal: true,
buttons: {
'close': function() {
$(this).dialog('close');
},
'create': function() {
var newDialogId = dialogId + '1';
$('body').append('<div id="' + newDialogId + '">' + newDialogId + '</div>');
createDialog(newDialogId);
}
},
close: function() {
$(this).dialog('destroy');
$(this).remove();
}
});
}
$(document).ready(function() {
$('#button1').click(function() {
var dialogId = 'dialog';
$('body').append('<div id="' + dialogId + '">' + dialogId + '</div>');
createDialog(dialogId);
});
});
</script>
</head>
<body>
<button id="button1">Create dialog</button>
</body>
</html>
Thanks