我嘗試上傳系統並使用Uploadify。我有onComplete功能,其中apend圖像和刪除按鈕。每張圖片都有自己的刪除按鈕,但我無法刪除它的圖片。請幫助這裏是我的代碼。謝謝。jQuery逐個刪除元素
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();
});
}
創建元素時,不應使用「live」。使用`bind`或者在onComplete處理程序之外分配`live`處理程序。 – Dennis 2011-12-15 13:21:10