Jquery .next() - not compatible for ie 6+7? What should I use?
jQuery .next()
- not compatible for ie 6+7 (write warning in netbeans editor).
What option that work in ie6+ie7 e开发者_开发百科xist in jQuery?
Delete edit because havy code
Thanks
next
works just fine in IE6 and IE7.
Example:
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
Tested and working in IE6 and IE7, both of which are on jQuery's list of supported browsers.
精彩评论