diff --git a/ejercicio3/ejercicio3.js b/ejercicio3/ejercicio3.js index 6ce9e92..de82d59 100644 --- a/ejercicio3/ejercicio3.js +++ b/ejercicio3/ejercicio3.js @@ -1 +1,11 @@ -// Agregar aquí el código javascript +const listaItems = document.getElementById('lista-items'); + +listaItems.addEventListener('click', (event) => { + const item = event.target; + + if (item.tagName.toLowerCase() !== 'li') { + return; + } + + item.classList.toggle('seleccionado'); +}); \ No newline at end of file diff --git a/ejercicio3/estilo.css b/ejercicio3/estilo.css index 159b7f6..0c7eb9d 100644 --- a/ejercicio3/estilo.css +++ b/ejercicio3/estilo.css @@ -1,2 +1,7 @@ /* Agregar el código CSS necesario para el ejercicio */ +.seleccionado { + background-color: yellow; + font-weight: bold; +} + diff --git a/ejercicio3/index.html b/ejercicio3/index.html index 678d7ee..1e38784 100644 --- a/ejercicio3/index.html +++ b/ejercicio3/index.html @@ -2,13 +2,22 @@
- +