【问题标题】:How can I set the uploaded picture?如何设置上传的图片?
【发布时间】:2017-10-19 08:20:48
【问题描述】:

我的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 个图像。而加号图标将丢失

我该怎么做?

【问题讨论】:

  • 你应该动态创建元素
  • @Satpal,您可以在 jsfiddle 中实现您的回答。因为我仍然对实现它感到困惑

标签: javascript jquery html css upload


【解决方案1】:

您希望循环遍历图像数组,然后将每个图像附加到每个框。

【讨论】:

  • 您可以在 jsfiddle 中实现您的回答。因为我仍然对实现它感到困惑
猜你喜欢
  • 2017-11-01
  • 1970-01-01
  • 2015-02-06
  • 1970-01-01
  • 2014-01-08
  • 2013-03-31
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多