JQuery Dialog最近给了我很多痛苦.
我有以下div想要弹出. (忽略类没有在语法中显示双引号)
我有以下div想要弹出. (忽略类没有在语法中显示双引号)
TABLE class=widget-title-table border=0 cellSpacing=0 cellPadding=0>
<TBODY>
<TR>
<TD class=widget-title><SPAN class=widget-title>Basic Info</SPAN></TD>
<TD class=widget-action>
<DIV id=edit-actions jQuery1266325647362="3">
<UL class="linkbutton-menu read-mode">
<LI class="control-actions">
<A id="action-button" class="mouse-over-pointer linkbutton">Delete this stakeholder</A>
<DIV id="confirmation" class="confirmation-dialog title=Confirmation">
Are you sure you want to delete this stakeholder?
</DIV>
</LI></UL></DIV></TD></TR></TBODY></TABLE>
这个JQuery是……
$(document).ready(function() {
$('#confirmation').dialog({
bgiframe: true,modal: true,autoOpen: false,cloSEOnescape: false,draggable: true,position: 'center',resizable: false,width: 400,height: 150
});
});
对话框是’开放’的
var confirmationBox = $('#confirmation',actionContent);
if (confirmationBox.length > 0) {
//Confirmation Needed
$(confirmationBox).dialog('option','buttons',{
'No': function() {
$(this).dialog('close');
},'Yes': function() {
$('ul.read-mode').hide();
$.post(requestUrl,{},ActionCallback(context[0],renderFormUrl),'json');
$(this).dialog('close');
}
});
$(confirmationBox).dialog('open');
}
问题始于初始化本身.
加载文档时,< div#confirmation>从标记中删除!
我之前有类似的问题,但我不能在这里使用该解决方案.
在这个页面上,我可以拥有多个PopUp div.
当我在打开之前添加初始化时;表格弹出.但在我关闭之后,div被删除了;所以我再也看不到弹出窗口了.
解决方法
你看到删除#confirmation的原因是因为$(“#foo”).dialog()会将#foo从DOM中的任何地方移动到文档底部,在包装元素中创建对话框样式最初隐藏.据了解,对话框在打开之前是隐藏的.