JSFiddle - React, Tailwind, and code Playground

by jlujan

HTML

<table id="tb_cartTable" border="1">
<tr>
    <td>One</td>
    <td>Two</td>
    <td>Three</td>
</tr>
<tr>
    <td>111</td>
    <td>222</td>
    <td>Threex</td>
</tr>
<tr>
    <td>hello</td>
    <td>Two</td>
    <td>world</td>
</tr>
</table>

JavaScript

var allCells = $('#tb_cartTable tr td:nth-child(2)');
var textMapping = {};
allCells.each(function() {
    textMapping[$(this).text()] = true;
});

var count = 0;
for (var text in textMapping)
    count++;

if (count !== allCells.length) {
    alert("found duplicate values");
} else {
    alert("no duplicates found");
}