forked from marquez.juan/clase-8-DOM
ejercicio 8
This commit is contained in:
@@ -83,7 +83,36 @@ function limpiarLista(idDeLaLista){
|
|||||||
|
|
||||||
const imagen = document.querySelector("img");
|
const imagen = document.querySelector("img");
|
||||||
|
|
||||||
console.log(imagen.getAttribute("src"));
|
|
||||||
imagen.setAttribute("src", "foto2.jpg");
|
imagen.setAttribute("src", "foto2.jpg");
|
||||||
imagen.setAttribute("alt", "Locro");
|
imagen.setAttribute("alt", "Locro");
|
||||||
console.log(imagen.getAttribute("alt"));
|
|
||||||
|
//ejercicio 8
|
||||||
|
|
||||||
|
const construirLista1 = (["Comidas mendocinas", "Sopaipilla", "Vino tinto"]);
|
||||||
|
|
||||||
|
function construirLista(){
|
||||||
|
const listaComidaMendoza = Array.from(construirLista1).filter(palabra => palabra.length)
|
||||||
|
|
||||||
|
if(listaComidaMendoza.length > 0){
|
||||||
|
const div1 = document.createElement("div");
|
||||||
|
div1.classList.add("grupo-comidas");
|
||||||
|
|
||||||
|
const miH2 = document.createElement("h2");
|
||||||
|
miH2.textContent = listaComidaMendoza[0];
|
||||||
|
div1.appendChild(miH2);
|
||||||
|
|
||||||
|
const agregarUl = document.createElement("ul");
|
||||||
|
agregarUl.classList.add("Comidas-mendocinas");
|
||||||
|
|
||||||
|
const agregarLi = document.createElement("li");
|
||||||
|
agregarLi.textContent = listaComidaMendoza[1];
|
||||||
|
agregarUl.appendChild(agregarLi);
|
||||||
|
|
||||||
|
const agregarLi2 = document.createElement("li");
|
||||||
|
agregarLi2.textContent = listaComidaMendoza[2];
|
||||||
|
agregarUl.appendChild(agregarLi2);
|
||||||
|
|
||||||
|
div1.appendChild(agregarUl);
|
||||||
|
document.body.appendChild(div1);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user