Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7568769
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T15:00:26+00:00 2026-05-30T15:00:26+00:00

I have a table with a header and some rows. Each row has its

  • 0

I have a table with a header and some rows. Each row has its own group, and sometimes they could be similar with the previous group codes.
Also, I have a drop-down list that contains groups IDs. I want to show just the rows that are equal with the drop-down list current value.
For example this is my table id="myTable":
enter image description here

and this is my drop-down:

<select id="groups" name="groups">
   <option value="1">1</option>
   <option value="2">2</option>
   <option value="3">3</option>
</select>

I need to remove 2nd and 3rd row when user change the current selected item of drop-down to 1.
How can I do it using jQuery ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T15:00:27+00:00Added an answer on May 30, 2026 at 3:00 pm

    Something like this:

    $("#groups").change(function() {
        var currentGroup = $(this).val();
        $("#myTable tr").each(function() {
           if (this.rowIndex==0) return; // skip heading
           if ($(this).children("td").eq(-1).text() == currentGroup)
              $(this).show();
           else
              $(this).hide();
        });
    });​
    

    Demo: http://jsfiddle.net/DBCcF/1/

    You could simplify the JS by giving the cells in the third column a particular class, but then I guess that complicates the markup, so…whatever you prefer.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When I have a table view with some sections which have their own headers
I have table inside a div tab. The table has 40 rows in it
I'm doing some manipulation and retrieval of values stored in a table. Each row
I have a html-table, that has a header, that is supposed to be clickable
I have a GridView with a header and some rows and want to add
I have a html table which has several rows - lets say 17 for
I have a table of data that contains about 260 rows. Each of these
i have a table with a button which adds some rows to the table
I have an object which I'm filling with objects containing 2 table rows each.
In a table of mine I have the table header, th which have two

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.