I have following problem. If I generate anhor "load_more_btn" via ajax then click function (the one with alert('test') ) wont work. Why is this happens and how to solve this problem?
<div id="content"></div>
<div id="load_more"></div>
<script type="text/javascript">
function getPhoto(paramType, param, page){
$.ajax({
url: "skrypt.php?paramType="+paramType+"¶m="+param+"&page="+page
}).done(function(data) {
$('#content').html(data);
var nextpage =page+1;
$('#load_more').html('<a href="#" id="load_more_btn" data-paramType="'+paramType+'" data-param="'+param+'" data-page="'+nextpage+'"=>Wczytaj więcej</a>');
});
}
$('#load_more_btn').click(function(){
alert('test');
});
</script>