我尝试执行上传系统并使用Uploadify。我有onComplete函数,用于添加图像并删除按钮。每个图像都有自己的“删除”按钮,但是我无法使其仅删除其图像。请帮助这里是我所拥有的代码。谢谢。

enter code here
'onComplete'  : function(event, ID, fileObj, response, data) {

    $('#inner2').append('<img id="img" src="'+fileObj.filePath+'" width="100" height="100" /><div id="remove-btn" ><span>Remove Image</span></div>');

    $("#remove-btn").live('click',function() {

        $(this).parent().remove();

    });

}

最佳答案

尝试选择previous图像。也就是说,在点击的div之前:

$(this).prev("img").andSelf().remove();

10-05 20:34
查看更多