0
我正在使用Plupload上传文件。出于具体原因,我必须将FilesAdded
“内”init
如下所示。如何绑定附加元素?
问题是,我无法使用附带jQuery的元素上的jQuery.remove()
。
我已经正常使用.on()
解决了这个问题,但是因为没有任何操作,比如click
等。我不确定如何绑定附加元素。
大加赞赏任何指导:)
// Custom example logic
var uploader = new plupload.Uploader({
runtimes : 'gears,html5,flash,silverlight,browserplus',
browse_button : 'btn-file-browse',
container : 'drag-drop-container',
drop_element : 'drag-drop-container',
max_file_size : sim_gal_data['max_file_size'],
url : sim_gal_data['upload_url'],
multi_selection : true,
init : {
FilesAdded: function(up, files) {
// Create list of files being uploaded
jQuery.each(files, function(i, file) {
jQuery('#filelist').append(
'<div id="' + file.id + '" class="file_upload">' +
'<div class="file_name">' + file.name + ' (' + plupload.formatSize(file.size) + ')' +
'</div> <label class="file_progress"><b></b></label>'
);
});
// Ready set go!
up.refresh();
up.start();
}
});
更新
这会触发remve:
uploader.bind('UploadComplete', function(up, files) {
jQuery('#filelist .file_name').remove();
// I'm able to run this - so maybe .file_name is appended?
jQuery('#filelist .file_name).append('TEST');
});
如果元素是当你查询它调用remove方法,它应该工作的DOM。什么触发了删除? – 2013-02-27 12:47:14
你的删除代码在哪里 – Pete 2013-02-27 13:26:12
@Pete我已经在我的问题 – Steven 2013-02-27 13:55:01