簡體   English   中英

為什么jquery在IE8中不起作用,但在chrome / firefox中

[英]why jquery not working in IE8 , but in chrome/firefox

我在IE 8中的jQuery代碼有問題。我有一個腳本,該腳本可以在div加載時動態構造一些UI。 這在chrome和firefox中工作正常,但在IE中不會加載。 下面的第二行不記錄任何內容。

AV.console.debug("start customer UI");
e = $("<div></div>").addClass("av-webassist-main").hide();
AV.console.debug("customerUI added main container");

它將第一個調試記錄在控制台中,此后什么也沒有記錄。 頁面保持空白。 如果我嘗試在控制台中運行第二行,

e = $("<div></div>").addClass("av-webassist-main").hide();

它拋出錯誤“ null”為null或不是對象知道如何調試它。 我正在使用jquery-1.9.1.js。

刪除或注釋掉console.debug行。 除非打開控制台,否則IE會使它們窒息。

jQuery是否已加載? 嘗試這個:

if (jQuery) {  
    alert('jQuery is loaded');
} else {
    alert('jQuery is not loaded');
}

如果您以其他方式創建DIV,該怎么辦? 喜歡

$(document.createElement('div'))

這會改變什么嗎?

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM