<分区>
Possible Duplicate:
jquery .is(“:visible”) not working in Chrome
我正在尝试获取数组中的所有可见项。它在 Firefox 中运行良好,但在 Chrome 中运行不正常。
这是我的代码:
$.each (t.config.promoInput, function (i, v) {
var size = 0;
$.each ($(v).find('option'), function (i, v) {
$(v).show() // Show all options in <tt>$(v)</tt>.
.not(':first-child') // Don't hide <tt>(All)</tt>.
.not(':Contains("' + t.config.searchSpanInput.val() + '")') // Don't hide options that match the searchCriteria.
.hide(); // Hide everthing that doesn't match or isn't (All).
if ($(v).is(":visible")) {
size++;
}
});
});
在 Firefox 中大小递增,而 Chrome 大小保持等于 0。
编辑: :Contains 是我自己对 jQuery 库的补充。它是 :contains 的不区分大小写的版本。