Answers for "duplicate images in webpage js"

0

duplicate images in webpage js

<div id="list"><img id="item" src = "picture.jpg"></div>

<script type="text/javascript">
  function cloneItem() {
      var item = document.getElementById("item");
      var list = document.getElementById("list");
      var clonedItem = item.cloneNode(true);
      list.appendChild(clonedItem);
  }

  for(var i = 0; i < 5; i++) {
    cloneItem();
  }
</script>
Posted by: Guest on July-27-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language