ejercicio 2: contador de caracteres en tiempo real

This commit is contained in:
2026-05-24 14:44:53 -03:00
parent 63f8bb23a3
commit e2d03163cb
2 changed files with 11 additions and 1 deletions

View File

@@ -7,3 +7,11 @@ boton.addEventListener('click', function() {
clickCount++;
parrafo.textContent = `Botón clickeado ${clickCount} veces`;
});
// Ejercicio 2 - Contador de caracteres en tiempo real
const campoTexto = document.getElementById('campoTexto');
const contadorCaracteres = document.getElementById('contadorCaracteres');
campoTexto.addEventListener('input', function() {
contadorCaracteres.textContent = `Caracteres ingresados: ${campoTexto.value.length}`;
});