Here is a sample of what I am trying to do.
<html>
<head>
<script type="text/javascript" language="javascript">
function doOpen() {
if ($('#dialog-modal').dialog('widget') == '')
document.getElementById('#dialog-modal').style.display = 'block';
else
$('#dialog-modal').dialog('open');
}
function doClose() {
if ($('#dialog-modal').dialog('widget') == '')
document.getElementById('#dialog-modal').style.display = 'none';
else
$('#dialog-modal').dialog('close');
}
function doAttach() {
$('#dialog-modal').dialog({
width: 'auto',
height: 'auto',
title: 'Popup Dialog',
autoOpen: false,
resizable: false,
modal: true
});
document.getElementById('dialog-modal').style.display = 'block';
}
</script>
</head>
<body>
<input type="button" id="Show" value="Open" onclick="doOpen();" />
<input type="button" id="Attach" value="Attach" onclick="doAttach();" />
<div id="dialog-modal" style="display:none">
Show this in a model dialog window<br />
<input type="button" id="Close" value="Close" onclick="doClose()" />
</div>
</body>
</html>
If I click “Attach” before doing anything else, the dialog shows up just fine. But if I click “Open” first, then I get the error. I need to know what this line should be to find out if dialog-modal has been attached to a dialog
if ($('#dialog-modal').dialog('widget') == '')
It’s a little hard to tell what you’re trying to do, but you could use data() to see if a dialog has been attached.