From e725cc5cb9b8641494ea5e88620229ac83c9963b Mon Sep 17 00:00:00 2001 From: Bruno Date: Wed, 27 May 2026 19:52:04 -0300 Subject: [PATCH 1/4] Resolucion del primer ejercicio --- clase-9.js | 7 +++++++ index.html | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/clase-9.js b/clase-9.js index 6df1007..5014129 100644 --- a/clase-9.js +++ b/clase-9.js @@ -1 +1,8 @@ // Agregar acá el código javascript para los ejercicios +//ejercicio 1 +const boton = document.querySelector("#boton"); +let contadorClicks = 0 +boton.addEventListener("click", () => { + contadorClicks = contadorClicks + 1; + boton.textContent = `Botón clickeado ${contadorClicks} veces` +}) \ No newline at end of file diff --git a/index.html b/index.html index 2a6b85f..6214d56 100644 --- a/index.html +++ b/index.html @@ -9,7 +9,7 @@

Clase 9 - Eventos

- +

-- 2.49.1 From 47730f361fad879cc564028ac3ee5205592c5036 Mon Sep 17 00:00:00 2001 From: Bruno Date: Wed, 27 May 2026 20:02:55 -0300 Subject: [PATCH 2/4] Resolucion del 2do ejercicio --- clase-9.js | 12 ++++++++++-- index.html | 3 ++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/clase-9.js b/clase-9.js index 5014129..d7418b1 100644 --- a/clase-9.js +++ b/clase-9.js @@ -1,8 +1,16 @@ // Agregar acá el código javascript para los ejercicios //ejercicio 1 const boton = document.querySelector("#boton"); -let contadorClicks = 0 +let contadorClicks = 0; boton.addEventListener("click", () => { contadorClicks = contadorClicks + 1; - boton.textContent = `Botón clickeado ${contadorClicks} veces` + boton.textContent = `Botón clickeado ${contadorClicks} veces`; +}) + +//ejercicio 2 +const campo = document.querySelector("#input2"); +const resultado = document.querySelector("#resultado"); +campo.addEventListener("input", () => { + const cantidad = campo.value.length; + resultado.textContent = `Caracteres: ${cantidad}`; }) \ No newline at end of file diff --git a/index.html b/index.html index 6214d56..142cc6f 100644 --- a/index.html +++ b/index.html @@ -13,7 +13,8 @@

- + +

Caracteres: 0


-- 2.49.1 From d2c918537fd8923287efd7159210a34f6ebbc321 Mon Sep 17 00:00:00 2001 From: Bruno Date: Wed, 27 May 2026 20:21:45 -0300 Subject: [PATCH 3/4] Resolucion del 3er ejercicio --- clase-9.js | 14 +++++++++++++- estilo.css | 6 ++++++ index.html | 8 +++++++- 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/clase-9.js b/clase-9.js index d7418b1..926bc76 100644 --- a/clase-9.js +++ b/clase-9.js @@ -13,4 +13,16 @@ const resultado = document.querySelector("#resultado"); campo.addEventListener("input", () => { const cantidad = campo.value.length; resultado.textContent = `Caracteres: ${cantidad}`; -}) \ No newline at end of file +}) + +//ejercicio 3 +const lista = document.querySelector("#lista"); +lista.addEventListener("click", (e) => { + if (e.target.tagName === "LI") { + const yaSeleccionado = document.querySelector(".seleccionado"); + if (yaSeleccionado) { + yaSeleccionado.classList.remove("seleccionado"); + } + e.target.classList.add("seleccionado"); + } +}); \ No newline at end of file diff --git a/estilo.css b/estilo.css index 19d93f8..2166a6f 100644 --- a/estilo.css +++ b/estilo.css @@ -3,3 +3,9 @@ div { padding: 10px; margin: 10px; } + +li.seleccionado { + background-color: blue; + color: white; + font-weight: bold; +} \ No newline at end of file diff --git a/index.html b/index.html index 142cc6f..71c83c4 100644 --- a/index.html +++ b/index.html @@ -18,7 +18,13 @@

- +

-- 2.49.1 From f569704b344fc60fc7372d2e8be473c6f8de9275 Mon Sep 17 00:00:00 2001 From: Bruno Date: Wed, 27 May 2026 20:28:02 -0300 Subject: [PATCH 4/4] Inicio del 4to ejercicio --- index.html | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/index.html b/index.html index 71c83c4..74e985a 100644 --- a/index.html +++ b/index.html @@ -28,7 +28,11 @@

- +
+
+ +
+

-- 2.49.1