Estoy intentando llamar una función para html añadido con append, por alguna razón el código siguiente no llama la función set_file en el evento onclick del botón: function addRow() { let html = "<tr>" + "<td><input class='form-control' type='text' id='datepicker' value='dd/mm/YYYY' size='6'></td>" + "<td><input class='form-control' type='text' size='1'/></td>" + "<td><textarea class='form-control' rows='2' cols='25'></textarea></td>" + "<td><input class='form-control' type='text' size='1'/></td>" + "<td><input class='form-control' type='text' size='1'/></td>" + "<td><select class='form-control'><option>Entidad</option></select></td>" + "<td><select class='form-control'><option>Tipo</option></select></td>" + "<td><button type='button' onclick='set_file("+maxAppend+",1)' id='get_file"+maxAppend+"1' class='btn btn-primary'><span class='glyphicon glyphicon-upload' style='float:right;display: inline-block;' aria-hidden='true'></span></button></td>" + "<input type='file' id='my_file"+maxAppend+"1'>" + "<td><button type='button' onclick='set_file("+maxAppend+",2)' id='get_file"+maxAppend+"2' class='btn btn-primary'><span class='glyphicon glyphicon-upload' style='float:right;display: inline-block;' aria-hidden='true'></span></button></td>" + "<input type='file' id='my_file"+maxAppend+"2'>" + "<td><button type='button' class='btn btn-warning'><span class='fa fa-edit' style='float:right;display: inline-block;' aria-hidden='true'></span></button></td>" + "</tr>"; $("#table_retentions").append(html); maxAppend++; } function set_file(i,j){ $('#my_file'+i+j).click(); } La consola no muestra errores ni warnings, ¿Qué es lo que estará mal?