forked from marquez.juan/clase-8-DOM
agregado de funcion agregarDiv
This commit is contained in:
@@ -26,8 +26,43 @@ console.log("Clase agregada a:", nuevoItem)
|
|||||||
const parrafos = document.querySelectorAll("#parrafos p");
|
const parrafos = document.querySelectorAll("#parrafos p");
|
||||||
|
|
||||||
for (const p of parrafos) {
|
for (const p of parrafos) {
|
||||||
|
|
||||||
if (p.textContent.includes("importante")) {
|
if (p.textContent.includes("importante")) {
|
||||||
p.classList.add("destacado");
|
p.classList.add("destacado");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//ejercicio 5
|
||||||
|
function agregarDiv() {
|
||||||
|
const nuevoDiv = document.createElement("div");
|
||||||
|
nuevoDiv.classList.add("grupo-comidas")
|
||||||
|
|
||||||
|
const nuevoh2 = document.createElement("h2");
|
||||||
|
nuevoh2.textContent = "Comidas tipicas de la region del litoral";
|
||||||
|
|
||||||
|
const pintroductorio = document.createElement("p");
|
||||||
|
pintroductorio.textContent = "Estas son algunas comidas tradicionales de la región del litoral argentino.";
|
||||||
|
pintroductorio.classList.add("teto-inicial")
|
||||||
|
|
||||||
|
const nuevoul = document.createElement("ul");
|
||||||
|
nuevoul.classList.add("lista-comida")
|
||||||
|
|
||||||
|
const comida1 = document.createElement("li");
|
||||||
|
comida1.textContent = "Chipa";
|
||||||
|
|
||||||
|
const comida2 = document.createElement("li");
|
||||||
|
comida2.textContent = "Surubi";
|
||||||
|
|
||||||
|
const comida3 = document.createElement("li");
|
||||||
|
comida3.textContent = "Mbaipy";
|
||||||
|
|
||||||
|
nuevoul.appendChild(comida1);
|
||||||
|
nuevoul.appendChild(comida2);
|
||||||
|
nuevoul.appendChild(comida3);
|
||||||
|
|
||||||
|
nuevoDiv.appendChild(nuevoh2);
|
||||||
|
nuevoDiv.appendChild(pintroductorio);
|
||||||
|
nuevoDiv.appendChild(nuevoul);
|
||||||
|
|
||||||
|
document.body.appendChild(nuevoDiv);
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user