documentfragment

Solutions on MaxInterview for documentfragment by the best coders in the world

showing results for - "documentfragment"
Davide
23 Mar 2019
1var list = document.querySelector('#list')
2var fruits = ['Apple', 'Orange', 'Banana', 'Melon']
3
4var fragment = new DocumentFragment()
5
6fruits.forEach(function (fruit) {
7  var li = document.createElement('li')
8  li.innerHTML = fruit
9  fragment.appendChild(li)
10})
11
12list.appendChild(fragment)
13
Fatma
02 Jun 2020
1var displayArray = […]; // Lots of img elements
2var holder = $('#imgSection').hide();
3for (var i=0; i<displayArray.length; i++)
4    holder.append(displayArray[i]);
5holder.show();
6