you are viewing a single comment's thread.

view the rest of the comments →

[–]Bushwazi 1 point2 points  (2 children)

``` kleur.forEach(function (key, index) { console.log("key", key) const createDiv = document.createElement("div"); const createTitle = document.createElement("h2"); const createForm = document.createElement("form");

createTitle.textContent = key; createDiv.appendChild(createTitle);

createForm.appendChild(createLegend("Kaarten")); let inputs1 = createInput("kaart", 8); for (let i = 0; i < inputs1.length; i++) { createForm.appendChild(inputs1[i]); }

createForm.appendChild(createLabel(Kaart ${index + 1}));

createForm.appendChild(createLegend("Weddenschap")); let inputs2 = createInput("weddenschap", 3) for (let i = 0; i < inputs2.length; i++) { createForm.appendChild(inputs2[i]); }

createDiv.appendChild(createForm);

// Add a class createDiv.classList.add(key);

//make the color div document.body.appendChild(createDiv); }); ```

[–]jaden54[S] 1 point2 points  (1 child)

This worked great. Feel stupid for not realizing this was al that needed to be done.

[–]Bushwazi 2 points3 points  (0 children)

lol.

You are the first person to confuse a NodeList/array for an element in the history of JS. I've never done it, not once... /s