MCPcopy
hub / github.com/e-oj/Magic-Grid / addItems

Function addItems

test/modify-items.js:1–17  ·  view source on GitHub ↗
(numItems= 10)

Source from the content-addressed store, hash-verified

1function addItems(numItems= 10) {
2 const container = document.querySelector(".container");
3 const items = container.children;
4 const lastItem = items[items.length - 1];
5 const lastNumber = parseInt(lastItem.innerHTML);
6
7 for (let i = 1; i <= numItems; i++){
8 const newDiv = document.createElement("div");
9 const newNumber = lastNumber + i;
10
11 newDiv.innerText = newNumber.toString();
12 container.appendChild(newDiv);
13 newDiv.classList.add(`item${newNumber}`);
14 }
15
16 magicGrid.positionItems();
17}
18
19function removeItems(numItems = 10) {
20 const container = document.querySelector(".container");

Callers

nothing calls this directly

Calls 1

positionItemsMethod · 0.80

Tested by

no test coverage detected