feat: add a greeting button with validation

This commit is contained in:
2026-05-25 12:11:37 -03:00
parent 610d2530dd
commit 110ed42897
2 changed files with 13 additions and 1 deletions

View File

@@ -1 +1,10 @@
// Agregar aquí el código javascript
document.getElementById('greet').addEventListener('click', () => {
const name = document.getElementById('name').value;
if (name.trim() === '') {
alert('Por favor, ingresa tu nombre.');
return;
}
document.getElementById('greeting').textContent = `¡Hola, ${name}!`;
});