From 927173b159b71599cd82fbe5b387623d69f9340c Mon Sep 17 00:00:00 2001 From: Facundo Saucedo <43495919@terciariourquiza.edu.ar> Date: Mon, 25 May 2026 12:14:49 -0300 Subject: [PATCH] feat: implement task addition functionality with input validation --- ejercicio2/ejercicio2.js | 14 ++++++++++++++ ejercicio2/index.html | 5 ++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/ejercicio2/ejercicio2.js b/ejercicio2/ejercicio2.js index 6ce9e92..57f894a 100644 --- a/ejercicio2/ejercicio2.js +++ b/ejercicio2/ejercicio2.js @@ -1 +1,15 @@ // Agregar aquí el código javascript + +document.getElementById('addTask').addEventListener('click', () => { + const taskInput = document.getElementById('task'); + const task = taskInput.value.trim(); + if (task === '') { + alert('Por favor, ingresa una tarea.'); + return; + } + const taskList = document.getElementById('taskList'); + const li = document.createElement('li'); + li.textContent = task; + taskList.appendChild(li); + taskInput.value = ''; +}); \ No newline at end of file diff --git a/ejercicio2/index.html b/ejercicio2/index.html index a6d71cf..0c5cb4d 100644 --- a/ejercicio2/index.html +++ b/ejercicio2/index.html @@ -8,7 +8,10 @@