Cree un selector de parrafos que agrega la palabra destacado
This commit is contained in:
@@ -15,9 +15,53 @@ const addClass = (className) => {
|
||||
}
|
||||
|
||||
// Ejercicio 3
|
||||
const agregarItem = (text) =>{
|
||||
const agregarItem = (text) => {
|
||||
const list = document.querySelector("#lista-inicial");
|
||||
const newLi = document.createElement("li");
|
||||
newLi.textContent = text;
|
||||
list.appendChild(newLi);
|
||||
}
|
||||
|
||||
// Ejercicio 4
|
||||
const parrafos = document.querySelectorAll("#parrafos p");
|
||||
|
||||
parrafos.forEach((p) => {
|
||||
if (p.textContent.toLowerCase().includes("importante")){
|
||||
p.classList.add("destacado");
|
||||
}
|
||||
});
|
||||
|
||||
// Ejercicio 5
|
||||
const agregarSec = () => {
|
||||
const div = document.createElement("div");
|
||||
const body = document.querySelector("body");
|
||||
body.appendChild(div);
|
||||
|
||||
const h2 = document.createElement("h2");
|
||||
h2.textContent = "Comidas tipicas del litoral";
|
||||
div.appendChild(h2);
|
||||
|
||||
const parrafo = document.createElement("p");
|
||||
parrafo.textContent = "El litoral tiene una gran variedad de Exquisiteses aqui les presentamos algunas de ellas";
|
||||
div.appendChild(parrafo);
|
||||
|
||||
const ul = document.createElement("ul");
|
||||
const comidas = ["Chipa","Sopa paraguaya","Pacu","Surubi","Mbeju"];
|
||||
comidas.forEach((comida) => {
|
||||
const li = document.createElement("li");
|
||||
li.textContent = comida;
|
||||
ul.appendChild(li);
|
||||
});
|
||||
|
||||
div.appendChild(ul);
|
||||
}
|
||||
|
||||
// Ejercicio 6
|
||||
const limpiarList = (id) => {
|
||||
const limpiar = document.getElementById(id);
|
||||
while(limpiar.firstChild){
|
||||
limpiar.removeChild(limpiar.firstChild);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user