Search code examples
jqueryjquery-file-uploadblueimp

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 input files(file uploaders) have the same class, say "a".

All input(buttons) have the same class, say "uploaddata".

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


Solution

  • if its dynamically created, try this:

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