工作我使用jQuery(1.6.2)的旧版本,似乎无法获得委托的工作。我有一个列表,我试图用一个单击事件委托,但它重新加载列表后失败。jQuery的委托不具有列表项
这里是我当前的代码:
$(".image_result").delegate("li", "click", function() {
//$('.image_result li').click(function() {
var imgInfo = $(this).attr('id').split(':');
if(confirm('Are you sure you want to delete this image?')) {
$.post('delete_image.php?image_id=' + imgInfo[0] + '&user_id=' + imgInfo[1], function(data) {
if (data.st) {
var resp = data.html.split("|");
$('#imageStats').html(resp[0]);
$('#imageTable').html(resp[1]);
}
else {
alert("Yikes, something went wrong");
}
}, "json");
}
});
的imageTable格设置现在拥有新的列表项(image_result)
我缺少什么?
你可以张贴HTML结构以及 – frictionlesspulley 2011-12-31 02:59:47
当你重新加载列表,你清理掉,并重新建立LIS,或者是你破坏并重新创建.image_result元素? – 2011-12-31 03:01:57