Pregunta

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();
        });
    });     
}
¿Fue útil?

Solución

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

}

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top