feat/excersices #6

Open
saucedo.facundo wants to merge 8 commits from saucedo.facundo/clase-8-DOM:feat/excersices into main
Showing only changes of commit 1628053703 - Show all commits

View File

@@ -75,4 +75,26 @@ const cleanList = (id) => {
const changeImage = () => {
const image = document.querySelector('img');
image.src = "foto2.jpg";
image.alt = 'Locro';}
image.alt = 'Locro';}
// Ejercicio 8
const buildList = (arr) => {
const div = document.createElement('div');
div.classList.add('grupo-comidas');
const h2 = document.createElement('h2');
h2.textContent = arr[0];
div.appendChild(h2);
const ul = document.createElement('ul');
for (let i = 1; i < arr.length; i++) {
const li = document.createElement('li');
li.textContent = arr[i];
ul.appendChild(li);
}
div.appendChild(ul);
return div;
};