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

  • Home
  • SEARCH
  • 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 9290385
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T20:24:28+00:00 2026-06-18T20:24:28+00:00

How can i search in multiple tables? I have this code, but this only

  • 0

How can i search in multiple tables? I have this code, but this only works for one of my tables. I have a total of 4 tables.

This is my code for search after “something” in my table.

$(document).ready(function() {
    $('#search').keyup(function() {
        searchTable($(this).val());
    });
});

function searchTable(inputVal) {
    var table = $('#searchTable');
    table.find('tr').each(function(index, row) {
        var allCells = $(row).find('td');
        if(allCells.length > 0) {
            var found = false;
            allCells.each(function(index, td) {
                var regExp = new RegExp(inputVal, 'i');
                if(regExp.test($(td).text())) {
                    found = true;
                    return false;
                }
            });
            if(found == true) $(row).show();
            else $(row).hide();
        }
    });
}

I’ve stripped my tables for code so that it looks more manageable out

The problem lies in “search tabe “only run Tables 1 through and not the remaining

Table 1:

<table class="table" id="searchTable">

Table 2:

<table class="table" id="searchTable">

Table 3:

<table class="table" id="searchTable">

Table 4:

<table class="table" id="searchTable">
  • 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-18T20:24:29+00:00Added an answer on June 18, 2026 at 8:24 pm

    Your problem is because of the IDs. IDs must be unique to each element, so once jQuery pulls the first ID it stops looking for any others.

    Replace $('#searchTable') with $('.table') and the problem should be fixed.

    You should also give those tables unique IDs or remove the IDs altogether if they’re not used.

    From the HTML specification: “There must not be multiple elements in a document that have the same id value.” http://www.w3.org/TR/html-markup/global-attributes.html

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

Sidebar

Related Questions

Have seen multiple posts on this but I can't see any which answer my
I want to write a php code that can search for multiple keywords separated
i have a single textbox named Keywords. User can enter multiple strings for search.
I have this query where I can search the TABLE_GLOBAL_PRODUCTS $catglobal_sql = select p.*,
This is quite weird but my search function can search for any word except
I have a table which has two fields. There can be multiple rows with
I have multiple models that I want to search such that the results can
If multiple grouping is used, jqgrid advanced search can generate search criteria like {groupOp:AND,rules:[],groups:[{groupOp:AND,rules:[{field:Nimi,op:cn,data:kk},{field:Nimi,op:cn,data:kkk}],groups:[]}]}
I need to modify a php search script so that it can handle multiple
So I can search the whole database but i need a way to change

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.