0

ユーザーが複数選択項目で何を選択したかに応じて、コードに複数のテーブル行を表示したいと思います。私のコードでは、何らかの理由で最後に選択された項目しか表示されません。誰か助けてもらえますか? 私のコードは次のとおりです。

if(List[x].selected)
{               
    $('table#newspaper-a tr:not(#header, #trWeekNummer)').hide();
    $('table#newspaper-a tr:not(#header, #trWeekNummer)').each(function(){      
        $('td:nth-child(1)',this).each(function(){  
            if($(this).text() == List[x].value)
                $(this).parent(this).show();
        });
    });     
}
4

1 に答える 1

0

私は自分で問題を解決しました。解決策は次のとおりです。

$('table#newspaper-a tr:not(#header, #trWeekNummer)').hide();

if(List[x].selected)
{               
$('table#newspaper-a tr:not(#header, #trWeekNummer)').each(function(){      
    $('td:nth-child(1)',this).each(function(){  
        if($(this).text() == List[x].value)
            $(this).parent(this).show();
    });
});     

}

于 2013-08-07T10:43:35.430 に答える