I’m sending ajax request and i have appended the result on a div. After this append if i want to click on a link appended (exec jquery click function), why click function doesen’t work? (Sorry for bad english 😛 )
EDIT:
jQuery('.more').live("click",function() {
var ID = jQuery(this).attr("id");
if(ID) {
jQuery("#more"+ID).html('<img src="template/css/images/moreajax.gif" />');
jQuery.ajax({
type: "POST",
url: "loadmore.php",
data: "lastid="+ ID,
cache: false,
success: function(html){
$("#contentWall").append(html);
jQuery("#more"+ID).remove(); // removing old more button
}
});
} else {
jQuery(".morebox").html('The End');// no results
}
return false;
});
You need to use
.live()or.on(), depending on your jQuery version for this to work.The regular
.click()only applies to the elements that are currently in the DOM, not for future additions.