可能重复:
jquery .is(“:visible”) not working in ChromejQuery的。是( “:可见”)在Firefox而不是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
编辑::包含是我自己除了jQuery库。它是一个不区分大小写的:contains的版本。
HTML的外观如何? – Pointy 2012-02-02 15:44:23
请注意,你必须关闭'每个'代码块 – 2012-02-02 15:46:18
另外,我不确定,但我认为引用嵌套函数中的i和v将访问父范围中的那些,所以不需要传递它们? – 2012-02-02 15:47:24