I have two tables, I have been using this code to to remove duplicate data found here:
var seen = {};
$('a').each(function() {
var txt = $(this).text();
if (seen[txt])
$(this).remove();
else
seen[txt] = true;
});
Works well the problem that I have is if I can't choose which duplicate field to be removed, for example if I have a layout like this, it will remove either the tbody with class="off" or the class without, the rows can be moved so can appear in any order:
<table>
<tbody class="off">
<tr>
<td>somedata</td>
</tr>
</tbody>
<tbody>
<tr>
<td>somedata</td>
</tr>
</tbody>
</table>
I wondered if anyone knew how to modify the code so that it remove the duplicate that always contained the class="off" or if anyone had any other techniques.
Thanks any help be appreciated.