Answers for "DocumentFragment"

0

DocumentFragment

var list = document.querySelector('#list')
var fruits = ['Apple', 'Orange', 'Banana', 'Melon']

var fragment = new DocumentFragment()

fruits.forEach(function (fruit) {
  var li = document.createElement('li')
  li.innerHTML = fruit
  fragment.appendChild(li)
})

list.appendChild(fragment)
Posted by: Guest on September-11-2020
0

jquery documentfragment

var displayArray = […]; // Lots of img elements
var holder = $('#imgSection').hide();
for (var i=0; i<displayArray.length; i++)
    holder.append(displayArray[i]);
holder.show();
Posted by: Guest on January-08-2021

Code answers related to "DocumentFragment"

Code answers related to "Javascript"

Browse Popular Code Answers by Language