ejercicio 3: agregar elementos a una lista con createElement

This commit is contained in:
2026-05-16 15:40:26 -03:00
parent 5f776002cc
commit 130e464ae5

View File

@@ -17,3 +17,14 @@ function destacarComidas() {
comida.style.color = "red"; comida.style.color = "red";
} }
} }
// 3
function agregarItem(texto) {
const lista = document.querySelector("#lista-inicial");
const nuevoItem = document.createElement("li");
nuevoItem.textContent = texto;
lista.appendChild(nuevoItem);
}