Sunil Chaudhry Sunil Chaudhry - 5 months ago 17
Javascript Question

How to apply jQuery File Uploader (blueimp) on dynamically created inputs

How to apply jQuery File Uploader (blueimp) on dynamically created input[type="files"].

All inputs(file uploaders) have the same class, say "a".

I tried the below jQuery but its not working it just pick the first fileuploader only.

$('.a').on('click', function (e) {
$(this).fileupload({
url: 'FileUploadHandler.ashx?upload=start',
-------
});
});


enter image description here

Answer

if its dynamically created, try this:

 $(document).on('click', '.a', function(){
        $(this).fileupload({
            url: 'FileUploadHandler.ashx?upload=start',
        -------
         });
   });