0

我在加载 javascript 时遇到了一些问题。使用jquery file upload,我必须加载一堆http://site/somefile.js似乎都被正确调用的文件(包含一个文件)。但是当页面被加载并且当我使用输入文件标签导入一些文件时,我必须添加$.getScript('http://site/somefile.js')以使文件导入正确。怎么会这样 ?`

4

2 回答 2

1

如果您使用来自https://github.com/blueimp/jQuery-File-Upload的 jquery 文件上传插件,那么我遇到了一些类似的问题。我修复了它#fileuploadform标签中添加目标ID而不是在input文件标签中

于 2013-08-02T11:51:08.673 回答
0

Well, if you insert a JavaScript file into a <input type="file"> then the javascript is not going to be executed, that would make no sense.

Why would you wan't to do this?

You could however,

$('#fileInput').on('change', function() {
    $.getScript( this.value );
});

But note this won't work with file:// addresses.

于 2013-08-01T18:08:30.167 回答