jQuery文件上传器:
https://github.com/blueimp/jQuery-File-Upload
我正在使用上面的插件.如何在jQuery中查看是否已经应用了fileUpload?
我现在收到以下错误:
@H_404_6@Uncaught FileUpload with namespace "file_upload" already assigned to this element jQuery.jQuery.extend._Deferred.deferred.resolveWithjquery-1.5.1.js:869 donejquery-1.5.1.js:6591 jQuery.ajaxTransport.send.callbackjquery-1.5.1.js:7382 @H_404_6@$('.upload').fileUploadUI({ ......... ......... .........谢谢
解决方法
您可以添加/设置一个类作为排序的标志.在这种情况下,我们将添加一个名为applied的类
@H_404_6@//scroll through each upload item
$('.upload').each(function(){
//Make sure class is not found
if (!$(this).hasClass('applied'))
//Apply Class and Upload Plugin
$(this).addClass('applied').fileUploadUI({...});
});
如yoavmatchulsky所指出的更新,您也可以更轻松地做到
@H_404_6@$('.upload:not(.applied)').addClass('applied').fileUploadUI({...});