forked from marquez.juan/clase-8-DOM
Compare commits
4 Commits
bd699429c8
...
4ea3de29e5
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4ea3de29e5 | ||
|
|
31030688a4 | ||
|
|
464c3bf1d2 | ||
|
|
ee728fe8eb |
@@ -50,7 +50,47 @@ function nuevoDiv() {
|
|||||||
const item1 = document.createElement("li");
|
const item1 = document.createElement("li");
|
||||||
item1.textContent = "Mbejú";
|
item1.textContent = "Mbejú";
|
||||||
listaLitoral.appendChild(item1);
|
listaLitoral.appendChild(item1);
|
||||||
const item2 =
|
const item2 = document.createElement("li");
|
||||||
listaLitoral.textContent = ["Mbejú, Chipa guazu, Sopa paraguaya, Vori Vori"]
|
item2.textContent = "Chipa guazu";
|
||||||
|
listaLitoral.appendChild(item2);
|
||||||
|
const item3 = document.createElement("li");
|
||||||
|
item3.textContent = "Sopa paraguaya";
|
||||||
|
listaLitoral.appendChild(item3);
|
||||||
|
const item4 = document.createElement("li");
|
||||||
|
item4.textContent = "Vori vori";
|
||||||
|
listaLitoral.appendChild(item4)
|
||||||
div.appendChild(listaLitoral);
|
div.appendChild(listaLitoral);
|
||||||
|
listaLitoral.id = "listaLitoral"
|
||||||
|
document.body.appendChild(div);
|
||||||
|
}
|
||||||
|
|
||||||
|
//ejercicio 6
|
||||||
|
function limpiarLista(idLista) {
|
||||||
|
const listaALimpiar = document.querySelectorAll(`#${idLista} li`);
|
||||||
|
for (const i of listaALimpiar) {
|
||||||
|
i.remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//ejercicio 7
|
||||||
|
const imagen = document.querySelector("#foto");
|
||||||
|
imagen.setAttribute("src", "foto2.jpg");
|
||||||
|
imagen.setAttribute("alt", "Locro");
|
||||||
|
console.log(imagen.getAttribute("alt"));
|
||||||
|
|
||||||
|
//ejercicio 8
|
||||||
|
function construirLista(arr) {
|
||||||
|
const div = document.createElement("div");
|
||||||
|
div.classList.add("grupo-comidas");
|
||||||
|
const titulo = document.createElement("h2");
|
||||||
|
titulo.textContent = arr[0];
|
||||||
|
div.appendChild(titulo);
|
||||||
|
const lista = document.createElement("ul");
|
||||||
|
for (let i = 1; i < arr.length; i ++) {
|
||||||
|
const item = document.createElement("li");
|
||||||
|
item.textContent = arr[i];
|
||||||
|
lista.appendChild(item);
|
||||||
|
}
|
||||||
|
div.appendChild(lista);
|
||||||
|
return div;
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user