8 Commits

Author SHA1 Message Date
maximo hidalgo
d7c0464b87 agrega funcion contruirLista 2026-05-21 17:57:51 -03:00
maximo hidalgo
42a6ea10b5 agrega modificador de imagen 2026-05-18 19:54:58 -03:00
maximo hidalgo
005d201af1 agrega funcion de limpiar lista 2026-05-18 19:49:32 -03:00
maximo hidalgo
c45bb28879 agregado de funcion agregarDiv 2026-05-18 19:35:58 -03:00
maximo hidalgo
306801b449 agregado de filtrado de parrafos importantes 2026-05-18 19:02:52 -03:00
maximo hidalgo
b50d8a2bb6 agregado funcion agregarItem 2026-05-18 18:46:47 -03:00
maximo hidalgo
09c0b0afc7 agrega funcion itemlista 2026-05-18 18:35:58 -03:00
maximo hidalgo
66ba54e04c agrega funcion cambiarTitulo 2026-05-18 18:12:52 -03:00
2 changed files with 106 additions and 0 deletions

View File

@@ -1 +1,106 @@
// Vincular este archivo al archivo index.html, y resolver aquí los ejercicios.
// ejercicio 1
function cambiarTitulo() {
const titulo = document.querySelector("h1");
titulo.textContent = "Comida Argentina";
}
//ejercicio 2
function itemlista() {
const item = document.querySelectorAll("ul li");
for (const p of item) {
p.classList.add("item-lista");
console.log("Clase agregada a:", p);
}
}
//ejercicio 3
function agregarItem(texto){
const lista = document.querySelector("ul");
const nuevoItem = document.createElement("li");
nuevoItem.textContent = texto ;
nuevoItem.id= "lista-inicial";
lista.appendChild(nuevoItem);
console.log("Clase agregada a:", nuevoItem)
}
//ejercicio 4
const parrafos = document.querySelectorAll("#parrafos p");
for (const p of parrafos) {
if (p.textContent.includes("importante")) {
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);
}
//ejercicio 6
function limpiarLista(idLista){
const borrador = document.querySelectorAll(`#${idLista} li`)
for (const li of borrador){
li.remove();
}
}
//ejercicio 7
const imagen = document.querySelector("img");
console.log(imagen.getAttribute("src"));
imagen.setAttribute("src", "foto2.jpg");
imagen.setAttribute("alt", "locro");
//ejercicio 8
const arrayComidas = ["Comidas mendocinas", "Sopaipilla", "Vino tinto"];
function construirLista(array){
const creaDiv = document.createElement("div");
creaDiv.classList.add("grupo-comidas");
const h2 = document.createElement("h2");
h2.textContent = array[0];
creaDiv.appendChild(h2);
const ul = document.createElement("ul");
for (let i = 1; i< array.length; i++){
const li = document.createElement("li");
li.textContent = array[i];
ul.appendChild(li);
}
creaDiv.appendChild(ul);
return creaDiv;
}

View File

@@ -31,5 +31,6 @@
<p>¿Y este párrafo? ¿Será importante?</p>
<p>Este es otro párrafo del montón.</p>
</div>
<script src="ejercicios-clase-8.js"></script>
</body>
</html>