.click() not working on .html() output
$(".nuotrauku_trynimas").click(function () {
alert('hi');
});
-------------------------------------------------------
Here goes ajax script. url, data, type, On complete (here it is)
onComplete: function(file, response){
kint = response.split(',');
status.html('');
$('<li id="'+kint[2]+'" class="success"></li>').appendTo('#files').css('display', 'none').fadeIn('fast').html('<img src="../prekes/'+kint[0]+'" alt="'+kint[0]+'" /><div class="nuotrauku_trynimas" id="'+kint[2]+'" style="float:right; cursor:pointer;"><img src="../images/cancel.png" alt="Ištrinti" /></div>');
}
If <div class="nuotrauku_trynimas"> is written in .php file, everything works fine. But when it is outputed by .html(), <div> is not reacting to click() function. Why? Any ideas?