我的html代码是这样的:
<div class="images">
<figure>
<button id="upload-add-product" class="icon-plus"></button>
<input id="upload-file" type="file" style="display: none;" multiple/>
</figure>
</div>
<div
...
我的JavaScript代码如下:
$("#upload-add-product").click(function(){
$("#upload-file").click();
});
...
演示和完整代码如下:http://jsfiddle.net/oscar11/daq37/11/
我的情况是这样的:
当我单击加号图标并选择2张图像然后2张图像时,它将出现在第一个框和第二个框中。加号图标将在第三个框上移动
当我单击加号图标并选择5张图像时,从第一个框到第五个框将显示5个图像。虽然加号图标将丢失
我该怎么做?
最佳答案
您要遍历图像数组,然后将每个图像附加到每个框。
关于javascript - 如何设置上传的图片?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/44066047/