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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T22:33:18+00:00 2026-05-26T22:33:18+00:00

i want to make something like a search box. There’s a text box and

  • 0

i want to make something like a search box.
There’s a text box and a table as shown in the html code below:

<input id="sbox" type="text" class="textbox" value=""></input>
<table>
  <tr><td>lemon</td></tr>
  <tr><td>orange</td></tr>
  <tr><td>watermelon</td></tr>
  <tr><td>coconut</td></tr>
</table>

How can i use jQuery to look for the table row with the matching value.
for example user typed in lemon and the jquery will find the table row with the “lemon” value and display:none others which don’t have lemon value

and the results will be :

<input id="sbox" type="text" class="textbox" value=""></input>
<table>
  <tr><td>lemon</td></tr>
  <tr style="display:none;"><td>orange</td></tr>
  <tr style="display:none;"><td>watermelon</td></tr>
  <tr style="display:none;"><td>coconut</td></tr>
</table>
  • 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-26T22:33:19+00:00Added an answer on May 26, 2026 at 10:33 pm

    I’m not sure how you want to activate the search so I’ll pretend that you have a button with an id of “go”. You could use filter like this:

    $('#go').click(function() {
        var want = $.trim($('#sbox').val());
        $('table tr > td').filter(function() {
            return $.trim($(this).text()) != want;
        }).parent().hide();
    });
    

    Demo: http://jsfiddle.net/ambiguous/qWaDs/2/

    You might want to add some toLowerCase calls if you want a case-insensitive search:

    $('#go').click(function() {
        var want = $.trim($('#sbox').val()).toLowerCase();
        $('table tr > td').filter(function() {
            return $.trim($(this).text()).toLowerCase() != want;
        }).parent().hide();
    });
    

    The $.trim calls are necessary in case your HTML ends up as:

    <tr>
        <td>
            lemon
        </td>
    </tr>
    <!--...-->
    

    If you don’t $.trim that row or cell you’ll end up with unwanted whitespace in your .text return value. There’s no good reason to bind your code’s behavior too tightly to the precise format of your HTML.

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

Sidebar

Related Questions

I'm trying to make a search in a table, something like this: http://www.phpjabbers.com/free-scripts/mysql-search-table/search.php I
I want to make something like this... :LoopBegin if ???? goto End some other
I have to make something like an accordion, but I want it to fade
say I want to make the first row of the excel ss something like
Okay, so I'm trying to make a full text search in multiple columns, something
I want to make a button generator with javascript in my site, something like
I want to make something that makes much sense, but I think its not
I have an object with event handlers and I want to make something similar
First of all, I want to make something clear before I get yelled at:
I want to make this kind of query: create procedure something @name varchar(13) as

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.