Javascript 无法删除分配给Uploadify对象的元素
我调用了一个简单的Uploadify插件,并在javascript中使用它,如:Javascript 无法删除分配给Uploadify对象的元素,javascript,jquery,uploadify,Javascript,Jquery,Uploadify,我调用了一个简单的Uploadify插件,并在javascript中使用它,如: $("#file").uploadify({ 'uploader': 'Scripts/uploadify.swf', 'cancelImg': 'Content/Images/cancel.png', 'buttonImg': 'Content/Images/upload-icon.png', 'auto': true,
$("#file").uploadify({
'uploader': 'Scripts/uploadify.swf',
'cancelImg': 'Content/Images/cancel.png',
'buttonImg': 'Content/Images/upload-icon.png',
'auto': true,
'method': 'post',
'script': '/Home/Upload', //path to MVC controller
'fileExt': '*.gif',
'fileDesc': 'Gif only (*.gif)',
'multi': false,
'onComplete': function (event, ID, fileObj, response, data) {
$(filenameAfterUpload).html(fileObj.name).show();
$(this).remove();
},
'onError': function (event, ID, fileObj, errorObj) {
alert(errorObj.info);
}
});
我想上传文件后,上传按钮本身必须删除,文件上传必须是可见的,它将成功的功能
<div class="upload-block">
<%=Html.LabelCustom("logo", "Logo") %> <!-- this is my custom helper-->
<input type="file" name="file" id="file" />
<span id="fileUploaded" class="hidden"></span> <!--I defined in CSS the hidden class-->
</div>
我希望必须删除/隐藏该文件。我试过$this.remove;但它不起作用
当然,上传系统工作正常,但这部分$this.remove;不起作用
我不会提及Uploadify在IE8的上传系统中也不起作用,因为SWF
谢谢。它与$'file'一起工作吗?删除?不,它不工作。我把Uploadify对象创建成通用函数,在很多地方使用。我知道这不是一个长期的解决方案,只是想看看问题是出在这方面还是其他方面。当你说它不工作时,你的意思是它没有删除元素并且没有任何类型的错误吗?你有没有把它放在我们可以看到它运行的地方?机制工作正常,但是$this.remove;不起作用,这意味着它不会自行移除。成功上载后,我想从输入html中删除此元素,该元素的类型为'file'。Firebug或其他Javascript调试器中是否存在任何错误?这行吗?onComplete:函数事件,ID,fileObj,响应,数据{var that=this;setTimeoutfunction{$that.remove},0;}