3
I’m making a request to 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 function .append()
he create there my vision straight but the button which I place in the append
with id='btnSelecionar' is not recognized in my DOM, I do not find this id on the page and can not do any js event with this button. So what would be the solution for him to recognize my button ?
You are using the function
on
jquery? Here you can help http://answall.com/questions/5196/qual-a-diff%C3%A7a-entre-o-onclick-Function-e-o-clickfunction– Marconi
put $("#btnSelect"). on("click",Function(){ Alert("test"); $("#modal-query-salario"). modal('Hide'); }); and it didn’t work :| @Marconi
– Jose Vieira Neto