forked from marquez.juan/clase-8-DOM
agrega funcion de limpiar lista
This commit is contained in:
@@ -45,7 +45,7 @@ function agregarDiv() {
|
|||||||
|
|
||||||
const nuevoul = document.createElement("ul");
|
const nuevoul = document.createElement("ul");
|
||||||
nuevoul.classList.add("lista-comida")
|
nuevoul.classList.add("lista-comida")
|
||||||
|
|
||||||
const comida1 = document.createElement("li");
|
const comida1 = document.createElement("li");
|
||||||
comida1.textContent = "Chipa";
|
comida1.textContent = "Chipa";
|
||||||
|
|
||||||
@@ -65,4 +65,11 @@ function agregarDiv() {
|
|||||||
|
|
||||||
document.body.appendChild(nuevoDiv);
|
document.body.appendChild(nuevoDiv);
|
||||||
}
|
}
|
||||||
|
//ejercicio 6
|
||||||
|
function limpiarLista(idLista){
|
||||||
|
const borrador = document.querySelectorAll(`#${idLista} li`)
|
||||||
|
for (const li of borrador){
|
||||||
|
li.remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//ejercicio 7
|
||||||
Reference in New Issue
Block a user