forked from marquez.juan/clase-8-DOM
32 lines
814 B
JavaScript
32 lines
814 B
JavaScript
// Vincular este archivo al archivo index.html, y resolver aquí los ejercicios.
|
|
function cambiarText(texto){
|
|
const textoH1 = document.querySelector("h1");
|
|
textoH1.textContent = texto;
|
|
}
|
|
|
|
function agregarClase(){
|
|
const listaComida = document.querySelectorAll(".item-comida");
|
|
for (const i of listaComida){
|
|
i.classList.add("item-lista");
|
|
}
|
|
}
|
|
|
|
function agregarItem(texto){
|
|
const lista = document.querySelector("#lista-inicial");
|
|
const nuevo = document.createElement("li");
|
|
|
|
nuevo.textContent = texto;
|
|
|
|
lista.appendChild(nuevo);
|
|
|
|
}
|
|
|
|
function destacarImportantes() {
|
|
const parrafos = document.querySelectorAll("#parrafos p");
|
|
|
|
for (const p of parrafos) {
|
|
if (p.textContent.includes("importante")) {
|
|
p.classList.add("destacado");
|
|
}
|
|
}
|
|
} |