我附加了从 Ajax 收到的数据,它还包含一个带有 bsubmit 类的分区。当页面加载时,如果我单击包含类 bsubit 的 div,则执行以下函数但是当我单击也包含类 bsubmit 的新附加数据时,则以下代码不起作用。
这是代码
$(function() {
$(".bsubmit").click(function() {
var id = $(this).parent().parent().attr("id");
var comm= document.getElementById(id).getElementsByClassName("commentadd")[0].value;
$.ajax({
type: "POST",
url: "comment.php",
data: {id:id, comm:comm},
cache: false,
success: function(data){
$('.addcomment').slideUp('slow', function() {
});
// Bottom Line not working
$("#"+id).find(".item_comment").append(data); // DATA Contains a div with class bsubmit
$(data).appendTo("#"+id).find(".item_comment"); // Now these Appended Div isnt calling this function again, Why ? I want to call them again
$('#load').fadeOut();
}
});
return false;
});
});