I have a table with data in in. For simplicity lets say it has only one column and no header. I want JQuery to iterate over all rows to see if the text in any of the cells in the same column is repeated in another row. Is there a simple way to do this?
<tr><td>one</td></tr>
<tr><td>two</td></tr>
<tr><td>three</td></tr>
<tr><td>four</td></tr>
<tr><td>five</td></tr>
<tr><td>one</td></tr> <!--It is doubled-->
<tr><td>six</td></tr>
You can use something like this :
This will take each of your row one by one and retrieve the value, check in previous values (stored in an array) if the value already exists, if not it adds it to the array else it displays a message in the console.
Instead of
console.log()you can do what you need, store it somewhere, change the class, etc.