Resolucion del 3er ejercicio

This commit is contained in:
Bruno
2026-05-27 20:21:45 -03:00
parent 47730f361f
commit d2c918537f
3 changed files with 26 additions and 2 deletions

View File

@@ -13,4 +13,16 @@ const resultado = document.querySelector("#resultado");
campo.addEventListener("input", () => {
const cantidad = campo.value.length;
resultado.textContent = `Caracteres: ${cantidad}`;
})
})
//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");
}
});