2013-08-07 73 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(); 
    }); 
});  

}