我想测试我的表是否有两行包含的行。我测试了这个,但它不起作用:
$("#resultat tr:not(:contains("+$('.devoirs option:selected ').text()+"))","#resultat tr:not(:contains("+$('.formateur option:selected ').text()+"))").each(function () {
$(this).hide();
});
首先,:not()
不支持真正的伪选择器,:contains
是jQuery规范。
您可能想要使用显式.not()
。
$('#resultat tr').not(':contains("'+$('.devoirs option:selected ').text()+'")')
.end().not(':contains("'+$('.formateur option:selected ').text()+'")').each(function(){
// do something
});