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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T04:41:13+00:00 2026-05-15T04:41:13+00:00

I am attempting to return columns of text where a column contains certain text.

  • 0

I am attempting to return columns of text where a column contains certain text.

For example: the text i’m looking for is “02/06/2010”.

<table>
    <tr>
        <td>Item Title1</td>
        <td>Item Category</td>
        <td>02/06/2010</td>
    </tr>    
    <tr>
        <td>Item Title2</td>
        <td>Item Category</td>
        <td>02/06/2010</td>
    </tr>
    <tr>
        <td>Item Title3</td>
        <td>Item Category</td>
        <td>10/07/2010</td>
    </tr>
</table>

For every row that contains the text I would like to be able to loop through and use information from the row columns.

I have managed to achieve this (see below) but am unable to access other columns. It is also not efficent and takes 10 seconds or so on a table with 2000 rows.

$('table tr td:nth-child(2) :contains("02/06/2010")');
  • 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-15T04:41:13+00:00Added an answer on May 15, 2026 at 4:41 am

    Try this instead, it might be quicker:

    $('table tr td:nth-child(2)').filter(function() {
        return $(this).text().indexOf('02/06/2010') != -1;
    }).closest('tr').css("border", "1px red solid");
    

    Also, since you seem to have a pretty large data set, there’s no harm in giving a pure DOM solution a shot, e.g.:

    var table = document.getElementsByTagName("table")[0];
    var rows = table.getElementsByTagName("tr");
    for(var i = 0; i < rows.length; i++) {
        var cell = rows[i].getElementsByTagName('td')[2];
        var cellText = cell.childNodes[0];
        if(cellText.data == '02/06/2010') {
            // do something with cell
        }
    }
    

    ​Try it here: http://jsfiddle.net/ANsUq/

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

Sidebar

Related Questions

I am attempting to return a rowcount from a subquery as part of a
I'm attempting to use Dapper to return a set of Shares and an associated
Attempting to use the data series from this example no longer passes the JSONLint
I am attempting to return the number of customers located in a specific state
I'm attempting to add an image to a datagrid item render dynamically in flex.
I am attempting to query entities with HQL in order to return a list
I am attempting to select column names from a SQL Server database with the
I'm attempting to write a query that will return any customer that has multiple
I am attempting the following formula: =concatenate(A1, , B1, - , C1) Where column
I am attempting to return the data from the rows with the most recent

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.