I have this inside a function:
$('#users').append($("<div id='usuarios'>").text(mensaje[1][i]));
I want to create an onclick event for this new <div>
. How can I achieve this?
I'm trying it like this outside the function:
$(document).ready(function(){
$('#usuarios').click(function() {
alert("click");
});
});
But it doesn't work.