JSFiddle - React, Tailwind, and code Playground

by Torwan

HTML

<table id="test">
    <tr>
        <td>test1</td>
    </tr>
    <tr>
        <td>test2</td>
    </tr>
    <tr>
        <td>test1</td>
    </tr>
    <tr>
        <td>test2</td>
    </tr>
    </table>
<input type="button" id ="btnRearrange" value="button" />

JavaScript

$('#btnRearrange').bind("click", function() {
var contents = {}, text;
    $( "#test td").each( function(){
    
    text = $(this).text();
        
        if( !( text in contents ) ) {
        contents[text] = true;
        }
        else {
        $( this.parentNode ).remove();
        }
    
    });
});