在尝试使用.dialog()显示许可协议时,我一直在IE11中收到此错误。 jQuery UI是v1.11.4。我试图切换到v1.12.1,它似乎没有解决这个问题。结果是该对话框仅显示在Chrome和Edge上。
SCRIPT5007:无法获取未定义或空引用的属性“remove” jquery-ui.min.js(8,4523)
代码示例:
<script type="text/javascript">
$(document).ready(function () {
$("[id*=LicenseAgreementButton]").click(function () {
$("[id*=licenseDialog]").dialog({
dialogClass: "no-close",
modal: true,
draggable: false,
resizable: false,
minWidth: 600,
title: 'License Agreement',
buttons: {
'Accept': function () {
$("#LicenseAgreementContainer span input").prop("checked", true);
$(this).dialog('close');
}
}
})
$("[id*=licenseDialog]").dialog('open');
})
});
</script>
<div class="listComponents">
<ul>
<asp:ListView ID="ListDcdFiles" runat="server" OnItemDataBound="ListDcdFiles_OnItemDataBound">
<ItemTemplate>
<li>
<span><%# ((IDcdFileInfo)Container.DataItem).DcdFileTitle %></span>
<asp:Panel runat="server" ID="pnlLicenseAgreement" CssClass="clearfix">
<asp:HiddenField runat="server" ID="hfDcdFileId"/>
<span class="dcdValidator"><TMA:TMACustomValidator runat="server" ID="vldCbAcceptAgreement" ShowInSummary="True" Enabled="True" ValidationGroup="ItemsList"
ErrorMessage="You must accept the license agreement in order to proceed" Text="*"
CssClass="validatedMessage" OnServerValidate="vldCbAcceptAgreement_OnServerValidate" /></span>
<div class="LicenseAgreementContainer" id="LicenseAgreementContainer">
<asp:CheckBox ID="cbAcceptAgreement" runat="server" Checked="False" Text="Accept License Agreement" CssClass="cbAuthorize" />
<div class="ViewLicenseAgreement">
<input type="button" class="linkButton" ID="LicenseAgreementButton" value="View License Agreement"/>
</div>
<div id="licenseDialog" style="display:none;">
<div data-role="main" class="LicenseAgreementText">
<asp:Literal runat="server" Mode="PassThrough" ID="htmlLicenseAgreement"></asp:Literal>
</div>
</div>
</div>
</asp:Panel>
</li>
</ItemTemplate>
</asp:ListView>
</ul>
</div>
答案 0 :(得分:0)
好的,感谢@Dimitri的评论,我能够解决这个问题。我只需要使用类来实例化Dialog。
<script type="text/javascript">
$(document).ready(function () {
$("#LicenseAgreementButton").click(showDialog);
$ldialog = $("#licenseDialog");
$ldialog.dialog({
dialogClass: "no-close",
autoOpen: false,
modal: true,
draggable: false,
resizable: false,
minWidth: 600,
title: 'License Agreement',
buttons: {
'Accept': function () {
$("#LicenseAgreementContainer span input").prop("checked", true);
$(this).dialog('close');
}
}
});
});
var showDialog = function () {
$ldialog.show();
$ldialog.dialog("open");
}
</script>