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 8533123
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T09:53:08+00:00 2026-06-11T09:53:08+00:00

Assume I have a standard HTML table structure like: <table class=table table-striped table-hover table-bordered

  • 0

Assume I have a standard HTML table structure like:

<table class="table table-striped table-hover table-bordered table-condensed">
<thead>
    <tr>
        <th>Name</th>
        <th>Type</th>
        <th>Added</th>
    </tr>
</thead>
<tbody>
    <tr id="1a0daa2734" class="item">
        <td><a href="/view/1a0daa2734">Item Number 1</a></td>
        <td>A</td>
        <td>8/1/2012 10:18:34 PM</td>
    </tr>
    <tr id="b1ff6e0ac" class="item">
        <td><a href="/view/b1ff6e0ac">Item Number 2</a></td>
        <td>B</td>
        <td>8/2/2012 5:48:54 PM</td>
    </tr>
    <tr id="edd8b70893" class="item">
        <td><a href="/view/edd8b70893">Item Number 3</a></td>
        <td>A</td>
        <td>8/13/2012 3:55:41 PM</td>
    </tr>
</tbody>
</table>

I am trying to write client side searching with jQuery. Basically I have a search box with an id of search-items.

    $("#search-items").bind("keyup paste", function() {
        var searchText = $("#search-items").val(); 

        $(".item").each(function() {
             //???
        });
    });

What is the best way to take the search value of search-items and find the NON-MATCHES inside of the tbody? I want the non-matches, because those are the elements I will hide.

It should only search inside the first two td elements, so the name and type columns, not added.

Thanks.

  • 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-06-11T09:53:09+00:00Added an answer on June 11, 2026 at 9:53 am

    The following code will try and match the values as you type them to either column1 or 2.

    $("#search").on("keyup paste", function() {
        var value = $(this).val().toUpperCase();
        var $rows = $("table tr");
    
        if(value === ''){
            $rows.show();
            return false;
        }
    
        $rows.each(function(index) {
            if (index !== 0) {
    
                $row = $(this);
    
                var column1 = $row.find("td:first a").html().toUpperCase();
                var column2 = $row.find("td").eq(1).text().toUpperCase();
    
                if ((column1.indexOf(value) > -1) || (column2.indexOf(value) > -1)) {
                    $row.show();
                }
                else {
                    $row.hide();
                }
            }
        });
    });​
    

    DEMO – Searching your table by column 1 and 2 values individually (not added)

    I’m sure there is a much more efficient way of writing it but this should get you started.

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

Sidebar

Related Questions

Suppose you have a standard org hierarchy table in Oracle. For simplicity sake, assume
Assume I have two tables, Student Test Id Name TestId Type StudentId -- ----
If I have a standard layout type like this: struct sl_t { int a;
Assume I have a set of numbers like 1,2,3,4,5,6,7 input as a single String
assume we have : class Dictionary { int n; int *ints; char **strs; inline
I would like to parse the menu structure for Gnome Panels (the standard Gnome
Silly question for the masses: Assume you have a table that handles the state
In VB.NET, let's assume I have the following Structure: Public Structure Product Public ItemNo
Assume we have a trivial Java program that consists of just one class: public
I have a simple HTML-page with a UTF-8 encoded link. <html> <head> <meta http-equiv="content-type"

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.