I do multiboot, this script should clone, and then click on input , to load a new photo. But he either clicks on the input , or only clones.

$(document).on('click', '#clonner', function() { $(document).find('.img-copy').first().clone(true, true).appendTo('.img-copy-append-here .row'); $('.img-copy').last().find('input[type="file"]').click(); }); 

This option will only click on the last input , commenting out the event click, the cloning works.

Block for cloning:

 ... <div style="display: none;"> <div class="col-md-3 img-copy"> <img src="http://lara53/imgs/no_image.png" > <input type="file" name="gallery[]" style="display: none;"> </div> </div> <form action="/product/add" method="post" enctype="multipart/form-data"> ... 
  • Need to dynamically add fields to a form? I understood correctly? - iKey
  • You have a fully working version. I click - everything clones and loads normally - Yuri

0