JSFiddle - React, Tailwind, and code Playground

by Dmitri Ganenco

HTML

<table id='table'>
<tr><td><a href='/link'>Test link</a></td></tr>
</table>

<button type='button' id='btn'>
Add row
</button>

JavaScript

const table = $('#table');
let counter = 1;

$('#btn').on('click', function(){
	const row = $('<tr>');
	const cell = $('<td>');
	const link = $('<a>', {
		href: '/linktest',
		text: 'Test link ' + counter++
	});
	
	cell.append(link);
	row.append(cell);
	table.append(row);
	
	table.trigger('table.updated');
});


table.on('table.updated', function(){
	$('#table a').each(function(){
	debugger;
		$(this).attr('href', '/whatever_you_want');
	});
})