Clase DOM #12

Open
routaboul.romeo wants to merge 9 commits from routaboul.romeo/clase-8-DOM:rama-b into main
Showing only changes of commit 84464db1b1 - Show all commits

View File

@@ -11,3 +11,14 @@ for(let item of array_li){
agregarClaseAItems("li"); //ejecutamos la funcion con la etiqueta HTML como parametro
//ejercicio3
function agregarItem(contenido){
let lista_inicial = document.querySelector("#lista-inicial"); // alojamos la lista en una variable
let item_nuevo = document.createElement("li"); // creamos el item
item_nuevo.textContent = contenido; // le otorgamos el contenido del parametro
lista_inicial.appendChild(item_nuevo); // añadimos el item a la lista
};
agregarItem("Guiso de lentejas");
agregarItem("Milanesa napolitana");
agregarItem("Medialunas");