Frage

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();
        });
    });     
}
War es hilfreich?

Lösung

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

}

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top