[jQuery] assign event click to dynamic create div (via php)
Hi, I have this question
have data coming from DB and put dynamicaly in a page through a while
cycle (php). How can I bind an event click to the generate html tag
(eg:<a id="link_agenzie" href="cerca2.php?cosa=<? echo
$cod['status']; ?>&agenzia=<? echo $cod['agenzia']; ?>" style="text-
decoration:none;">SOLO</a>)
I have this code
<script type="text/javascript">
$(document).ready(function(){
$("#link_agenzie").click(function(){
var params = $(this).attr("href");
params = params.split("?");
$('#loading').html('<div id="loading">Caricamento in
corso ...</div>');
$.ajax({
url: ""+params[0]+"",
data: ""+params[1]+"&"+params[2]+"",
success: function(html){
$("#wrapper").append(html);}
});
});
});
</script>
but only the first link is working, not the subsequent
please help
franco