Trying to select a sibling element using jQuery and it doesn\'t work in IE7.
Here is my sample code: http://jsfiddle.net/y7AHz/6/ (click Run to see result)
This is a known bug with sizzle (the selector engine underneath jQuery) in IE6 and 7. Instead, use .next()
, which is equivalent to the +
or next adjacent
selector, and .find()
. It's more verbose, but it works in IE6+:
var numberOfListItems = $("#txtInput").next(".ulContainer").find("li").length;
Updated jsFiddle