Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

140
Vistas
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 Respuestas
Responde la pregunta

0

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

if I understand correctly

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda