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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T21:15:09+00:00 2026-06-08T21:15:09+00:00

I have a table in my HTML, and in this table the individual values

  • 0

I have a table in my HTML, and in this table the individual values within the <td> tags are generated from an Javascript array.

I want to compare the values contained in the <td> tags against each other and check for duplicates.

  • 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-08T21:15:10+00:00Added an answer on June 8, 2026 at 9:15 pm

    <td> elements don’t have a value, they have contents (that may or may not include other elements). If your question is “How do I check that no two td elements have the same contents?” you can do something like this:

    var contents = {},
        duplicates = false;
    $("#yourtableidhere td").each(function() {
        var tdContent = $(this).text();
        if (contents[tdContent]) {
            duplicates = true;
            return false;
        }
        contents[tdContent] = true;
    });    
    if (duplicates)
       alert("There were duplicates.");
    

    You don’t say when this process should occur, but if in response to the user clicking a button or something then put the above code in a click event handler.

    Demo: http://jsfiddle.net/FA6SR/

    Obviously you can expand the above to note exactly which cells had duplicate values, what the values were, etc.

    EDIT – P.S. You mention that the values come from an array. It would be just as easy to code the comparison test against the array rather than against the table cells, but more efficient at runtime. jQuery wouldn’t really help with that, you’d just use a standard for loop.

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

Sidebar

Related Questions

I have a HTML table as follows. I want retrieve row values from this
I have this html table: <table class=table-all> <tbody> <tr> <td>BISFENOLO</td> <td>Bisfenolo-AF 10/10</td> <td class=right>€
so I have this HTML table with a bunch of big numbers in it
I have a html table like this: Invoice# Due Date Balance Select 12345 12/25/2011
I have a HTML table like this: <table border=1> <tbody> <tr> <td><a href=# class=delete>DELETE
I have a HTML table like this: <table border=1> <tbody> <tr> <td><a href=# class=delete>DELETE
A newbie question,really. Suppose I have a html table like this: <div id=div1> <table
I have an html table that looks like this in a standard HTML 4.01
I have an HTML table containing a few rows (this is built dynamically). All
I have an HTML table in my jsp page. This conains text fields and

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.