我試圖從較老的版本升級到JQuery 1.10。不幸的是,升級之前工作的代碼會導致失敗,此錯誤:如何確切地確定哪個方法引發此錯誤:Javascript:Object不支持此屬性或方法
微軟JScript運行時錯誤:對象不支持此屬性或方法
這不幸的是,該消息並沒有告訴我到底是哪方法或屬性導致此錯誤。
舉個例子,我收到此錯誤試圖調用一個對話框顯示:
$('#RepSearchDialog').dialog({
autoOpen: true,
width: 1050,
height: 500,
resizable: false,
title: 'Rep Search',
modal: true,
open: function() {
ClearRepSearchCriteriaFields();
ClearRepSearchResults();
$('.ui-dialog-titlebar').hide();
$('#RepSearchStoreId').val($('#StoreId').val());
$('#RepSearchStoreId').focus();
$('input[name="RepSearchOption"]:checked').removeAttr('checked');
$('input[name="RepSearchOption"]')[4].checked = true;
window.RepSearchDialog_SearchForReps();
}
});
這不是明顯對我哪個屬性或方法調用導致對話框調用失敗。我如何才能獲得導致此失敗的確切屬性或方法的信息?
這使得升級非常非常痛苦。
按F12鍵並使用內置的調試控制檯查看牀單編號。 –
凱文,它只是指向我上面列出的代碼行。然後它說:「Uncaught TypeError:Object [object Object] has no method'dialog'」咦?那麼爲什麼不.dialog()工作了? WTF? –
有些事情干擾'$(「#RepSearchDialog」)'返回一個正確的jQuery對象。要麼,要麼你沒有成功加載jQuery UI(也許你還需要升級它)。 – Barmar