Answers for "document fragment"

0

document fragment

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

Code answers related to "Javascript"

Browse Popular Code Answers by Language