From 28718fea20110d916c30a8a006a59ef197b23424 Mon Sep 17 00:00:00 2001 From: Facundo Saucedo <43495919@terciariourquiza.edu.ar> Date: Mon, 25 May 2026 12:17:39 -0300 Subject: [PATCH] feat: add item list with click event to toggle selection --- ejercicio3/ejercicio3.js | 6 ++++++ ejercicio3/estilo.css | 3 +++ ejercicio3/index.html | 9 ++++++++- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/ejercicio3/ejercicio3.js b/ejercicio3/ejercicio3.js index 6ce9e92..9e6e908 100644 --- a/ejercicio3/ejercicio3.js +++ b/ejercicio3/ejercicio3.js @@ -1 +1,7 @@ // Agregar aquí el código javascript + +document.getElementById('itemList').addEventListener('click', (event) => { + if (event.target.tagName === 'LI') { + event.target.classList.toggle('selected'); + } +}); \ No newline at end of file diff --git a/ejercicio3/estilo.css b/ejercicio3/estilo.css index 159b7f6..492839e 100644 --- a/ejercicio3/estilo.css +++ b/ejercicio3/estilo.css @@ -1,2 +1,5 @@ /* Agregar el código CSS necesario para el ejercicio */ +.selected { + background-color: lightblue; +} \ No newline at end of file diff --git a/ejercicio3/index.html b/ejercicio3/index.html index 678d7ee..bee57d5 100644 --- a/ejercicio3/index.html +++ b/ejercicio3/index.html @@ -8,7 +8,14 @@