I am making a request for my server with $.get
of Jquery, and populating my table with the method below:
$.get(/*[[@{/empregados/salariosMinimos.json}]]*/ 'consultaEstadoSalario', {uf : uf,data : data})
.done(function(salarioestado){
$("#tabela-salario-estado tbody tr").remove();
for(var i in salarioestado){
if(salarioestado[i].dataFim == null){
salarioestado[i].dataFim = "";
}
var linhaTabela = $("<tr><td> " + formateDateJson(salarioestado[i].dataInicio) + " </td> <td> " + formateDateJson(salarioestado[i].dataFim) +" </td><td class='text-right'> " + currencyFormat(salarioestado[i].valor)+" </td> " + "<td ><button id='btnSelecionar' class='btnSelecionar pull-right btn btn-xs btn-primary' type='submit' title='selecionar'><span class='glyphicon glyphicon-ok'></span></button></td>" + "</tr>");
$("#tabela-salario-estado").append(linhaTabela);
}
});
The problem is that when I run the .append()
function it creates my view right there, but the button that I put in append
with id = 'btnSelect' is not recognized in my DOM , that is, I can not find this id on the page and I can not do any js event with this button. So what would be the solution for him to recognize my button?