2013-08-07 7 views
0

사용자가 다중 선택 항목에서 선택하는 내용에 따라 코드가 여러 테이블 행을 표시하도록하고 싶습니다. 내 코드는 어떤 이유로 마지막으로 선택한 항목 만 표시합니다. 누군가 나를 도와 줄 수 있습니까? 내 코드입니다 : 내가 문제를 스스로 해결 한Javascript 다중 선택에서 여러 테이블 행 표시

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

당신은 이것에 대한 바이올린을 만들 수 있습니까? –

+0

바이올린은 어떻게 만듭니 까? 죄송합니다. 저는 여기에서 새로 왔습니다 :) – BjornBogers

+1

http://jsfiddle.net/ – nyzm

답변

0

, 솔루션이었다

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

}