質問

I would like my code to show multiple table rows depending on what the user selects in the multiple select item. My code only shows the last selected item for some reason, could someone please help me? My code is:

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();
        });
    });     
}
役に立ちましたか?

解決

I have fixed the problem myself, the solution was:

$('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();
    });
});     

}

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top