I have a table and i'm trying to delete rows if any values in the first column are identical. how could i achieve this using javascript or jquery?
$("table tr").each(function () {
var tdText = $(this).text();
$("table tr")
.filter(function () {
return tdText == $(this).text();
})
.not(":first")
.remove();
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<table>
<thead>
<tr>
<th>Product Code</th>
<th>Item Name</th>
<th>Long Description</th>
<th>Material</th>
<th>Style</th>
</tr>
</thead>
<tbody>
<tr>
<td><input></td>
<td><input></td>
<td><input></td>
<td><input></td>
<td><input></td>
</tr>
<tr>
<td><input></td>
<td><input></td>
<td><input></td>
<td><input></td>
<td><input></td>
</tr>
<tr>
<td><input></td>
<td><input></td>
<td><input></td>
<td><input></td>
<td><input></td>
</tr>
</tbody>
</table>