2014-06-17 69 views
0

我想測試我的表是否有包含兩行的行。我測試了這一點,但它不工作:語法jQuery for contains test

$("#resultat tr:not(:contains("+$('.devoirs option:selected ').text()+"))","#resultat tr:not(:contains("+$('.formateur option:selected ').text()+"))").each(function() { 
    $(this).hide(); 
}); 

回答

0

首先,:not()不支持真正僞選擇和:contains是jQuery的specififc。

您可能想要使用顯式.not()

$('#resultat tr').not(':contains("'+$('.devoirs option:selected ').text()+'")') 
.end().not(':contains("'+$('.formateur option:selected ').text()+'")').each(function(){ 
    // do something 
}); 
+0

感謝.not(),但代碼不工作時,我有兩個包含whith一個完美的作品。 謝謝 – user3749204