我收到以下错误:
Uncaught Error: Cannot find template script at ID 'qq-template'!
我找到了这个答案:Uncaught Error: Cannot find template script at ID 'qq-template'! ,但它对我没有帮助,因为我的html代码中有一个模板:
<script type="text/template" id="qq-template">
<div class="qq-uploader-selector qq-uploader span12">
<div class="qq-upload-drop-area-selector qq-upload-drop-area span12" qq-hide-dropzone>
<span>****my custom text****</span>
</div>
<div class="qq-upload-button-selector qq-upload-button btn btn-success" style="width: auto;">
<div><i class="icon-upload icon-white"></i>****my custom text****</div>
</div>
<span class="qq-drop-processing-selector qq-drop-processing">
<span>****my custom text****</span>
<span class="qq-drop-processing-spinner-selector qq-drop-processing-spinner"></span>
</span>
<ul class="qq-upload-list-selector qq-upload-list" style="margin-top: 10px; text-align: center;">
<li>
<div class="qq-progress-bar-container-selector">
<div class="qq-progress-bar-selector qq-progress-bar"></div>
</div>
<span class="qq-upload-spinner-selector qq-upload-spinner"></span>
<span class="qq-upload-file-selector qq-upload-file"></span>
<span class="qq-upload-size-selector qq-upload-size"></span>
<a class="qq-upload-cancel-selector qq-upload-cancel" href="#">****my custom text****</a>
<span class="qq-upload-status-text-selector qq-upload-status-text"></span>
</li>
</ul>
</div>
</script>
我可以通过致电:
成功获得它document.getElementById('qq-template')
我在官方示例中找到了这个模板,除了我的自定义文本外,我保持不变。
我试图将此元素放在&lt; head&gt;内。和&lt; body&gt;,但我一直收到错误。
Fine-uploader版本是4.0.3。
有什么问题?我该怎么做才能解决这个问题?
答案 0 :(得分:-1)
感谢@Shreyas
问题是我把这段代码:
window.onload = createUploader();
而不是:
window.onload = createUploader;
'createUploader()'是创建上传器实例的函数。
这种简单的错误是原因。