Question

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();
        });
    });     
}
Était-ce utile?

La solution

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

}

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top