feat/excersices #1

Open
saucedo.facundo wants to merge 9 commits from saucedo.facundo/clase-10-ejercicios-de-repaso:feat/excersices into main
2 changed files with 18 additions and 1 deletions
Showing only changes of commit 927173b159 - Show all commits

View File

@@ -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 = '';
});

View File

@@ -8,7 +8,10 @@
</head>
<body>
<h1>Ejercicio 2</h1>
<label for="task">Crea una nueva tarea:</label>
<input type="text" id="task" name="task">
<button id="addTask">Agregar tarea</button>
<ul id="taskList"></ul>
<script src="ejercicio2.js"></script>
</body>
</html>