简体   繁体   中英

How to use Jquery plug in Multi File upload on Dynamically added File input box

Hi I am using Jquery plug in jquery.MultiFile.pack.js . usage of this plug in requires input form element to be of class "multi"

<input id="preview" class="multi" name="preview[]" type="file" />

I am adding form elements dynamically from a PHP script. Multi file upload is not working when the elements are added dynamically, but works when element is allready present directly in the .

My question is how do I make this multi file upload to work. I tried to add class "multi" to the elements usng "on" as below, but it is not working.

$('input:file').on('click',function(){
  $('#preview').addClass("multi");

});

对于接受多文件选择的 HTML 文件输入,您必须为其添加multiple属性:

<input id="preview" class="multi" name="preview[]" type="file" multiple/>

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