I have a button that append a template containing few divs and buttons. The first button "btnGenerateResult_0" works fine probably because it exists when the page loads, while "btnGenerateResult_1" gets created but doesn't work. How and where can I fix the event listener and attach it to these buttons, I need four buttons?
The bellow code is inside a document.readey function():
$(`#btnGenerateResult_${active}`).click(function ()
{
var newrow = "";
for (var i = 1; i < TablesObj[activeTableObj[active]].length; i ++ )
{
newrow = "";
newrow= "<tr><td>" + TablesObj[activeTableObj[active]][i][0] +
"</td><td>" + TablesObj[activeTableObj[active]][i][3] +
"</tr>";
$(`#resultTableMain_${active}`).append(newrow);
}
});