I'm trying to display unique rows based on values of the first column.I have tried this a lot taking cue from a similar question.
<table id="test" border="1">
<tr>
<td>test1</td>
<td>test2</td>
<td>test3</td>
</tr>
<tr>
<td>test1</td>
<td>test2</td>
<td>test5</td>
</tr>
<tr>
<td>test6</td>
<td>test2</td>
<td>test5</td>
</tr>
<tr>
<td>test6</td>
<td>test6</td>
<td>test9</td>
</tr>
</table
>
**BEFORE**
test1 test2 test3
test1 test2 test5
test6 test2 test5
test6 test6 test9
**AFTER**
test1 test2 test3
test6 test2 test5
Here's what I have tried using codes from a similar situation
arr = [];
$('#test td').each(function(){
key = "" + $(this).index();
if(arr.indexOf( key ) == 1)
arr.push($.trim($(this).text()));
else
$(this).closest('tr').hide();
alert(arr[]);
});
**RESULT**:
test1 test2 test3