我正在使用Jquery 上传文件插件。除了我不确定如何使它适用于动态添加的文件上传控件之外,它似乎很完美。文档似乎没有任何这样的例子。
<div id="container">
<div class="fileuploader">Upload</div>
</div>
<button id="btnadd">CLICK</button>
$(".fileuploader").uploadFile({
url: "YOUR_FILE_UPLOAD_URL",
fileName: "myfile"
});
$('#btnadd').on('click', function () {
$("#container").append('<div class="fileuploader">Upload</div>');
//-----if i uncomment this, it would work. But I want to avoid this.
// $(".fileuploader").uploadFile({
// url:"YOUR_FILE_UPLOAD_URL",
// fileName:"myfile"
// });
});