Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

139
Visualizações
Hide all tr whose id is not the value selected

I have a razor pages project where i need the user to select between filtering between some ports and the names of variables, i kinda got the search bar working, but I can't make the other one work.

Here's what I've got so far:

<div class="col-12 border text-left p-3 mt-3" id="filterdiv">
    <div id="dropdown">
        @Html.DropDownList("ports", (IEnumerable<SelectListItem>)ViewData["ports"], new { @id = "portdd" })
    </div>
    <div id="searchbar">
        <p>
            Name: <input type="text" name="SearchString" id="searchb"/>
        </p>
    </div>
</div>

@* FILTER BY PORTS *@
<script type="text/javascript">
    $(document).ready(function () {
        $('#portdd').change(function () {
            var value = this.value;
            $('tr:gt(0):not($(#' + value + '):attr(id))').hide();
        });
    });
</script>

@* FILTER BY NAME *@
<script type="text/javascript">
    $(document).ready(function () {
        $('#searchb').change(function () {
            var value = this.value;
            $('tr:gt(0):not(:contains(' + value + '))').hide();
        });
    });
</script>

But it's not working as intended. Any help would be appreciated.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

$('tr:gt(0)[id !=' + value + ']').hide();

if I understand correctly

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda