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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T21:42:30+00:00 2026-05-22T21:42:30+00:00

I have an html table where one of the columns contains <span> s with

  • 0

I have an html table where one of the columns contains <span>s with comma-delimited data. I want to come up with a jQuery selector that returns all of the rows (<tr>s are preferable, but the <span>s will work for now) where one of the comma-delimited tokens <span> in a span tag matches a supplied string.

I started with something like the following:

$('td.col_8 span:contains("duck")')

which will get me all spans in a particular column containing the word ‘duck’. However, it could also match <span>fox, mallard-duck</span>. Since ‘duck’ is not a unique token in that span, I wouldn’t want that included in the match.

Is there a way to narrow my result set so I’m only including results where there’s an exact match to a particular token in a column-delimited list?

(I’m using jQuery 1.2.3)

  • 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-22T21:42:31+00:00Added an answer on May 22, 2026 at 9:42 pm

    This is where the beauty of jQuery expressions come in.

    You can add your own custom selector. I’m going to call it tag in this case

    jQuery.expr[":"].tag = function(elem, index, match, nodeList) {
        var tags = $(elem).text().replace(/(?:\ +)?,(?:\ +)?/g, ",").split(",");
        return tags.indexOf(match[3]) > -1;
    }
    

    This will check each previously matched element against this selector. Fist it flattens the , seperations (so something like “firstTag , onotherer, badly , spaced, tag” will work). jQuery already takes care of parsing the selector and passes it in as match. match[3] is what you’re interested in. With the following usage match[3] will be ‘duck’

    $('td.col_8 span:tag("duck")')
    

    the return line will return true of false based on the tag being in the list.

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

Sidebar

Related Questions

I have an html table that literally has like 30 columns of data, and
I have an html table with one of the headers spanning over 2 columns.
I have an html table and one column (or <td> ) contains very long
I have a table which has columns of data that contain status. Two example
I have a table with many columns. One of the columns contains a cell
I have an HTML table with two columns. For the last row, I want
I have an HTML table with one column being email addresses; spambot issues aside,
see fiddle i have html table and one textbox and one button.make cell selection
My problem is I have one html table in jsp page .And i applied
I am creating one form in html using table. Which have one Drop down

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.