forked from marquez.juan/clase-8-DOM
22 lines
685 B
JavaScript
22 lines
685 B
JavaScript
// Vincular este archivo al archivo index.html, y resolver aquí los ejercicios.
|
|
console.log("El archivo esta vinculado correctamente.")
|
|
|
|
const parrafo = document.querySelector("h1");
|
|
console.log(parrafo.textContent);
|
|
parrafo.textContent = "Hola a todos!";
|
|
|
|
function agregarLista() {
|
|
const items = document.querySelectorAll(".lista-comidas");
|
|
for (const item of items) {
|
|
item.classList.add("resaltada");
|
|
}
|
|
}
|
|
|
|
const lista = document.querySelector("ul");
|
|
|
|
function agregarItem(){
|
|
const nuevoItem = document.createElement("li");
|
|
let itemAgregado = prompt("Ingresa un nuevo item");
|
|
nuevoItem.textContent = itemAgregado;
|
|
lista.appendChild(nuevoItem);
|
|
} |