/ / escolha todos exceto "this" em jquery - jquery

escolha todos exceto "this" em jquery - jquery

Consegui esconder linhas correspondentes a um valor como este:

$(document).ready(function() {
$("select[name=select1]").change(function() {
$("td").each(function(index, paragraph) {
$td = $(paragraph);
if ($td.html() === $("select[name=select1]").val()) {
//hide the matched row rather than remove it
$(not(this)).parent("tr:first").hide();
}
});
$("select[name="select1"]").on("change", function() {
$("tr").show();
});
});
});

O que estou fazendo de errado?

Respostas:

1 para resposta № 1

Eu não sei o seu código HTML, mas apenas ocultar todos os elementos e "unhide" o que você não quer esconder.

if ($td.html() === $("select[name=select1]").val()) {
//hide the matched row rather than remove it
$("tr").hide();
$(this).parent("tr:first").show();
}