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