Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/75.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
jQuery反问题_Jquery_Jsf - Fatal编程技术网

jQuery反问题

jQuery反问题,jquery,jsf,Jquery,Jsf,我有一张桌子,我想数一数我藏了多少tr 守则: <rich:jQuery query="ready(function() { var i = 0; jQuery('#inbox:_inboxTable_').find('span[title=isArchivedStatusPlusIncludeArchive]').each(function(i, o){ if (jQuery(this).text() == 'true+false' ){

我有一张桌子,我想数一数我藏了多少tr

守则:

<rich:jQuery query="ready(function() {
var i = 0;
jQuery('#inbox:_inboxTable_').find('span[title=isArchivedStatusPlusIncludeArchive]').each(function(i, o){
        if (jQuery(this).text() == 'true+false' ){
                i++;
                alert(i);
                jQuery(this).parent().parent().parent().fadeOut();
        }
    jQuery('#inbox').find('span[title=documentProccesedCountTitle]').html(i+' documents are beeing processed to be removed from the inbox');
});
})"/>

对于一个有10 tr的页面,在我的测试中,7被这部分代码隐藏了,但是在最后一步,“i”是10而不是7

我只是不知道…为什么? 有人知道原因吗

提前谢谢。

关于:

$("#table_id tr:hidden").length
那么:

$("#table_id tr:hidden").length

i=10
因为您使用它作为函数的索引,请尝试使用
j
或其他方法:

jQuery('#inbox:_inboxTable_').find('span[title=isArchivedStatusPlusIncludeArchive]').each(function(j, o){
...
}

另外,不要使用
jQuery(this.parent().parent().parent().fadeOut()
可以使用
jQuery(this.closest('tr').fadeOut()
(如果目标是
tr

i=10
,因为您使用它作为函数的索引,请尝试使用
j
或其他方法:

jQuery('#inbox:_inboxTable_').find('span[title=isArchivedStatusPlusIncludeArchive]').each(function(j, o){
...
}

另外,不要使用
jQuery(this.parent().parent().parent().fadeOut()
可以使用
jQuery(this.closest('tr').fadeOut()
(如果
tr
是您的目标)。

这是一个来自jsf的富数据表。这是一个来自jsf的富数据表。还有其他tr隐藏,所以我不能指望这个解决方案。还有其他tr隐藏,所以我不能指望这个解决方案。我知道这是一个小问题:)非常感谢。关于你答案的第二部分:最近('tr')在Firefox中有有害的行为。我在使用
最近的
时从来没有遇到过问题,你遇到过或听说过什么问题?我很好奇。下面是对我遇到的问题的更大描述:我知道这是个小问题:)非常感谢。关于你答案的第二部分:最近的('tr')在Firefox中有有害的行为。我在使用
最近的
时从来没有遇到过问题,您遇到过或听说过什么问题?我很好奇。以下是我遇到的问题的详细描述: