1. 程式人生 > >onchange第二次點選失效的解決辦法

onchange第二次點選失效的解決辦法

$("#Qrcode").on("change",function(){
		replace();
	});
	function replace()
	{
		$.ajaxFileUpload({
			url:"__CONTROLLER__/QrcodeSet",
			secureuri:false,  
        	fileElementId:'Qrcode',//file標籤的id  
       		dataType: 'json',//返回資料的型別  
       		cache:false,
       		success: function(data)
       		{
       			$(".qcode img").attr("src","__UPLOADS__/admin/qrcode/"+data.msg).attr("data",data.msg);
       		 	$("#Qrcode").replaceWith('<input type="file" id="Qrcode" name="Qrcode">'); 
           		 $("#Qrcode").on("change",function(){
         			replace();
         		});
       		},
       		error(xml,c,e)
       		{
       			alert(e);
       		}
		});
	}