0

jQuery .next() - 與ie 6 + 7不兼容(在NetBeans編輯器中寫入警告)。Jquery .next() - 與ie 6 + 7不兼容?我應該使用什麼?

jQuery中存在ie6 + ie7中的哪些選項?

刪除編輯因爲havy代碼

感謝

+1

DId你測試這個以獲得證明,或者你相信編輯說什麼? – 2011-02-04 13:09:45

+0

我有代碼不工作在ie6 + ie7但在ie8洙工作我試圖找出爲什麼 – Yosef 2011-02-04 13:30:53

回答

5

next作品只是在IE6和IE7的罰款。

例子:

HTML:

<div id='container'> 
    <div>Target A</div> 
    <div>Target B</div> 
    <div>Target C</div> 
</div> 

的JavaScript:

jQuery(function($) { 

    $("#container div").click(function() { 
    var next = $(this).next(); 
    if (next.length == 0) { 
     display("There's no div after this one"); 
    } 
    else { 
     display("The next div's text is: " + next.text()); 
    } 
    }); 

    function display(msg) { 
    $("<p/>").html(msg).appendTo(document.body); 
    } 

});​ 

Live copy

測試和在IE6和IE7的工作,這兩者都是對jQuery的list of supported browsers