JSFiddle - React, Tailwind, and code Playground
HTML
<div id="display"></div>
<a href="#" id="new">Add a new line</a>
JavaScript
$(document).ready(function(){
function test_function(number) { /* This function is not triggered, nothing works inside here!! */ }
var lines = [];
function update_list(lines)
{
var thecode = '';
for(var i=0; i<lines.length; i++)
{
thecode = thecode + lines[i] +' <a onclick="javascript:test_function('+i+')" href="#">(delete)</a><br />';
}
$('div#display').html(thecode);
}
$('a#new').click(function() { lines.push('another line'); update_list(lines); });
});