简体   繁体   中英

loading javascript files issue

I am experiencing some issue with javascript loading. Using the jquery file upload , I have to load a bunch of files (containing a file http://site/somefile.js ) that all seem to be correctly called. But when the page is loaded and when I import some file using an input file tag, I have to add $.getScript('http://site/somefile.js') to make the file import correct. How can it be ? `

If you're using the jquery file upload plugin from https://github.com/blueimp/jQuery-File-Upload , then I experienced some similar issue. I fixed it adding the target id #fileupload in the form tag rather that in the input file tag

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM