ejercicio 2: contador de caracteres en tiempo real
This commit is contained in:
@@ -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}`;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user