2015-04-30 63 views
0

刪除時我有以下的代碼,復位輸入文件:事件處理程序復位輸入文件

$(this).replaceWith($(this).clone()); 

不過,我注意到,如果我使用的特定輸入文件,它激發事件沒有處理。因此,這是處理文件輸入更改時事件的代碼:

$('#frontfile').change(function(){ 
     reader2 = Main.Mod.image_change(this); 
     reader2.onload = rearImageIsLoaded; 
    }); 

什麼似乎是問題?

您的回答將不勝感激......

回答

1

可以傳遞真實的clone method克隆與它

$(this).replaceWith($(this).clone(true, true)); 
+1

或'.clone相關的處理程序和數據(真,假)'視關於你想要達到的目標。 –