私は JQuery ダイアログのモーダル ポップアップ機能を使用しており、おそらく 5 ~ 6 か月間使用しています。今日まで、動作に問題はありませんでした。私のコンピューターではすべて正常に動作しますが、別の従業員が JQuery エラーを受け取り、ポップアップが表示されません。それは昨日彼のために働いていて、コードベースに変更はコミットされていません.
Chrome のインスペクト要素オプションを使用していますが、「('div') には 'parent()' 関数がありません」などのエラーが表示されます。このエラーの意味は理解できますが、そもそもなぜ表示されるのかわかりません。私がチェックした残りのコンピュータはすべて正常に動作しています。また、ブラウザ関連ではありません。IE、FF、Chrome で壊れました。
今朝、Windows の更新があったことは知っていますが、Windows の更新によって JQuery の機能が損なわれるとは考えられません。ここで他に何が起こっているのかについて何か考えはありますか?
function ModalPopup(divId, parentId, isExtender) {
if (isExtender == "True") {
ModalPopupExtender(parentId, divId);
return;
}
var div = document.getElementById(divId);
//Disable any datepickers on the popup otherwise they will display on load
var datePickers = $(div).find("input[class='datePicker hasDatepicker']");
datePickers.each(function (index) {
$(this).datepicker('disable');
});
//Find the buttons on the div
var buttons = $(div).find("input[type='submit']");
buttons.each(function (index) {
$(this).click(function () {
Cancel(divId);
//$(div).dialog("close");
});
$(this).attr("style", "padding:5px; margin:5px; color:#696969; background-color:#EEE; border-radius:6px;");
});
//Create a footer div, add the buttons to the div
$footerDiv = $('<div style="height:40px;" />');
for (var i = 0; i < buttons.length; ++i) {
$footerDiv.append(buttons[i]);
}
//Add a canel button that closes the popu
$cancelBtn = $('<input type="button" style="padding:5px; margin:5px; color:#696969; background-color:#EEE; border-radius:6px;" value="Cancel" onclick="Cancel(\'' + divId + '\')" />');
$footerDiv.append($cancelBtn);
//Display the div with the info
$(div).attr("style", "display:block; font-size: 11px;");
//Display the dialog box
$(div).dialog({ minWidth: 300,
minHeight: 150,
maxHeight: 400,
draggable: false,
resizeable: false,
modal: true,
buttons:
{
'Cancel': function () {
$(div).dialog("close");
}
},
open: function (e, ui) {
$(e.target).parent().find('span').filter(function () {
return $(this).text() === 'Cancel';
}).parent().replaceWith($footerDiv);
//Adjust the width for IE
var version = getInternetExplorerVersion();
if (version != -1 && version < 8.0) {
$(e.target).dialog('option', 'width', ($(e.target)[0].scrollWidth + 50) + 'px');
}
else
$(e.target).dialog('option', 'width', 'auto');
//Adjust the height if the dialog is too big
if ($(div).height() > 800)
$(e.target).dialog('option', 'height', 800);
$(e.target).dialog('option', 'position', 'center');
}
});
//Hide the title bar
$(div).dialog().parents(".ui-dialog").find(".ui-dialog-titlebar").hide();
$(div).parent().appendTo(jQuery("form:first"));
//Enable the datepickers again after the dialog has opened
datePickers.each(function (index) {
$(this).datepicker('enable');
});
//Style any select boxes to be the width of their container
$(div).find("select:[multiple]").each(function () {
$(this).width("100%");
});
}
編集ボタンをクリックしてポップアップを表示すると、すぐにエラー メッセージが表示され、ページが更新されます。