Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

138
Views
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 answers
Answer question

0

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

if I understand correctly

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!