JQuery Dialogは、最近私に多くの苦痛を与えています。ポップアップしたい次の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>
れると、マークアップから削除されます。以前に同様の問題が発生しましたが、ここではその解決策を使用できません。このページでは、複数のポップアップdivを使用できます。
開く直前に初期化を追加したとき。フォームがポップアップしました。しかし、閉じた後、divは削除されます。そのため、ポップアップを再度表示することはできません。