JSFiddle - React, Tailwind, and code Playground

HTML

<table>
    <tr>
        <td>foo</td>
        
    </tr>
    <tr>
        <td>bar</td>
    </tr>
    <tr>
        
        <td>baz</td>
    </tr>
</table>
insert after row 
<input type="text" id="index"/> with <input type="text" id="content"/>
<a>click here to Insert</a>

CSS

table tr td
{
    border:1px solid;
}

JavaScript

$('a').click(function(){
    var index = parseInt($('#index').val());
    
if(index >= 0)
{
   $('<tr><td>'+$("#content").val() +'</td></tr>').insertBefore($('table tr').eq(index));
}
});