I want to remove duplicate cells of a column.
<table id="test" border="1">
<tr>
<td>test1<td>
<td>test2<td>
<td>test3<td>
</tr>
<tr>
<td>test4<td>
<td>test2<td>
<td>test5<td>
</tr>
<tr>
<td>test6<td>
<td>test2<td>
<td>test5<td>
</tr>
<tr>
<td>test6<td>
<td>test8<td>
<td>test9<td>
</tr>
</table>
output
------
test1 test2 test3
test4 test2 test5
test6 test2 test9
test6 test8 test9
I want in this format
---------------------
test1 test2 test3
test4 test5
test6 test9
test8
This only removes duplicate text across columns. It works because elements are selected in document order:
It probably won’t work though if you have cells spanning multiple columns.
Slightly adjusted DEMO.
Update: For consecutive cells only. The idea is to keep track of the previous value that was seen in one column.
DEMO (note
test5in the right column)