Javascript显示来自多个select的多个表行
我希望我的代码根据用户在多个选择项中选择的内容显示多个表行。由于某种原因,我的代码只显示最后选择的项目,有人能帮我吗?我的代码是:Javascript显示来自多个select的多个表行,javascript,multiple-select,Javascript,Multiple Select,我希望我的代码根据用户在多个选择项中选择的内容显示多个表行。由于某种原因,我的代码只显示最后选择的项目,有人能帮我吗?我的代码是: if(List[x].selected) { $('table#newspaper-a tr:not(#header, #trWeekNummer)').hide(); $('table#newspaper-a tr:not(#header, #trWeekNummer)').each(function(){
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();
});
});
}
我自己解决了这个问题,解决方案是:
$('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();
});
});
}你能为这个做一把小提琴吗?我怎么做小提琴?对不起,我是新来的:)你可以去jsfiddle.net。将js、html和css粘贴到相关列中,然后点击save。我很想这样做,但是里面有太多的数据库连接,所以我要在里面放一个精简版本。这是一个非常精简的版本的真正的表,但我希望你得到的想法。