onchange第二次點選失效的解決辦法
阿新 • • 發佈:2019-02-11
$("#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); } }); }