forked from marquez.juan/clase-8-DOM
Compare commits
3 Commits
8366bbb7d6
...
bd699429c8
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bd699429c8 | ||
|
|
898d4ccdbe | ||
|
|
66ef232929 |
@@ -1,10 +1,12 @@
|
||||
// Vincular este archivo al archivo index.html, y resolver aquí los ejercicios.
|
||||
//ejercicio 1
|
||||
const titulo = document.querySelector("h1");
|
||||
function cambiarTitulo(titulo) {
|
||||
titulo.textContent = "Comidas clásicas/típicas de Argentina";
|
||||
return(titulo)
|
||||
}
|
||||
|
||||
//ejercicio 2
|
||||
const item = document.querySelectorAll("ul li");
|
||||
for (const i of item) {
|
||||
console.log(i.textContent);
|
||||
@@ -18,12 +20,37 @@ function itemLista() {
|
||||
}
|
||||
}
|
||||
|
||||
//ejercicio 3
|
||||
const lista = document.querySelector("#lista-inicial");
|
||||
|
||||
|
||||
function agregarItem() {
|
||||
const listaInicial = document.querySelector("#lista-inicial");
|
||||
for (const l of listaInicial) {
|
||||
function agregarItem(texto) {
|
||||
const nuevoElemento = document.createElement("li");
|
||||
}
|
||||
return(nuevoElemento)
|
||||
nuevoElemento.textContent = texto;
|
||||
lista.appendChild(nuevoElemento);
|
||||
}
|
||||
|
||||
//ejercicio 4
|
||||
const parrafos = document.querySelectorAll("#parrafos p");
|
||||
parrafos.forEach(p => {
|
||||
if (p.textContent.includes("importante")) {
|
||||
p.classList.add("destacado");
|
||||
}
|
||||
});
|
||||
|
||||
//ejercicio 5;
|
||||
function nuevoDiv() {
|
||||
const div = document.createElement("div")
|
||||
const h2 = document.createElement("h2");
|
||||
h2.textContent = "Comidas tipicas de la region del litoral";
|
||||
div.appendChild(h2);
|
||||
const p = document.createElement("p");
|
||||
p.textContent = "Algunas de las comidas mas tipicas del litoral pueden ser: ";
|
||||
div.appendChild(p);
|
||||
const listaLitoral = document.createElement("ul");
|
||||
const item1 = document.createElement("li");
|
||||
item1.textContent = "Mbejú";
|
||||
listaLitoral.appendChild(item1);
|
||||
const item2 =
|
||||
listaLitoral.textContent = ["Mbejú, Chipa guazu, Sopa paraguaya, Vori Vori"]
|
||||
div.appendChild(listaLitoral);
|
||||
}
|
||||
Reference in New Issue
Block a user