forked from marquez.juan/clase-8-DOM
Resolucion del 4to ejercicio
This commit is contained in:
@@ -27,4 +27,12 @@ function agregarItem(texto) {
|
|||||||
const nuevoElemento = document.createElement("li");
|
const nuevoElemento = document.createElement("li");
|
||||||
nuevoElemento.textContent = texto;
|
nuevoElemento.textContent = texto;
|
||||||
lista.appendChild(nuevoElemento);
|
lista.appendChild(nuevoElemento);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//ejercicio 4
|
||||||
|
const parrafos = document.querySelectorAll("#parrafos p");
|
||||||
|
parrafos.forEach(p => {
|
||||||
|
if (p.textContent.includes("importante")) {
|
||||||
|
p.classList.add("destacado");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user