JSFiddle - React, Tailwind, and code Playground

by andreortigao

HTML

<table>
    <tr><td>...</td></tr>
    <tr>
    <td id="pp" class="text-right"><!-- I want this td in the top of table when a is clicked-->
        <a>
        <i class=""> foo</i>
        </a>
    </td>
    </tr>
<tr><td>...</td></tr>
</table>

JavaScript

$("#pp a").on('click', function(){
    var tr = $(this).closest('tr');
    tr.prependTo(tr.closest('table'))
});