forked from marquez.juan/clase-9-eventos
30 lines
722 B
JavaScript
30 lines
722 B
JavaScript
const botonf = document.getElementById("boton1");
|
|
const parrafob = document.getElementById("parrafo1");
|
|
|
|
let contador = 0;
|
|
|
|
botonf.addEventListener("click", () => {
|
|
contador++;
|
|
parrafob.textContent = "Boton clickeado " + contador + " veces";
|
|
}) // Ejercicio 1
|
|
|
|
|
|
|
|
const textoCaracter = document.getElementById("text");
|
|
const parrafoCaracter = document.getElementById("carac0");
|
|
|
|
|
|
textoCaracter.addEventListener("input", () => {
|
|
parrafoCaracter.textContent = "Cantidad de caracteres: " + textoCaracter.value.length
|
|
}) // Ejercicio 2
|
|
|
|
|
|
const listaEvent = document.getElementById("itemListas");
|
|
listaEvent.addEventListener("click",(e) => {
|
|
if (e.target.tagName == "LI") {
|
|
console.log(e.target.textContent);
|
|
}
|
|
|
|
|
|
})
|