Insert into table and then click using Jquery [duplicate]

0

I'm dynamically inserting into my table, so far so good. The problem is how much I try to click on one of the lines and I have no answer, I believe that I am not inserting in the DOM, someone could help me.

INSERTING:

$('#tabelaChat').append('<tr><td style="font-size: 9pt;">'+ data.flag[i].nome +'</td></tr>');

BY CLICKING:

$('#tabelaChat tr').on('click', function(e){
                alert("Teste");          
                return false;
});
    
asked by anonymous 12.11.2014 / 17:20

1 answer

1

Try to use it as well

$('#tabelaChat').on('click','tr', function(e){
                alert("Teste");          
                return false;
});
    
12.11.2014 / 17:23