mirror of
https://github.com/Alvin-Zilverstand/ict-algemeen-opdrachten.git
synced 2026-03-06 13:23:58 +01:00
Add start and end date inputs to To-Do List application
This commit is contained in:
@@ -1,10 +1,19 @@
|
||||
document.getElementById('add-task').addEventListener('click', function() {
|
||||
const taskText = document.getElementById('new-task').value;
|
||||
const startDate = document.getElementById('start-date').value;
|
||||
const endDate = document.getElementById('end-date').value;
|
||||
if (taskText === '') return;
|
||||
|
||||
const li = document.createElement('li');
|
||||
li.textContent = taskText;
|
||||
|
||||
const taskDetails = document.createElement('div');
|
||||
taskDetails.className = 'task-details';
|
||||
taskDetails.innerHTML = `
|
||||
<span>Start Date: ${startDate}</span>
|
||||
<span>End Date: ${endDate}</span>
|
||||
`;
|
||||
|
||||
const completeButton = document.createElement('button');
|
||||
completeButton.textContent = 'Complete';
|
||||
completeButton.addEventListener('click', function() {
|
||||
@@ -17,9 +26,12 @@ document.getElementById('add-task').addEventListener('click', function() {
|
||||
li.remove();
|
||||
});
|
||||
|
||||
li.appendChild(taskDetails);
|
||||
li.appendChild(completeButton);
|
||||
li.appendChild(deleteButton);
|
||||
|
||||
document.getElementById('task-list').appendChild(li);
|
||||
document.getElementById('new-task').value = '';
|
||||
document.getElementById('start-date').value = '';
|
||||
document.getElementById('end-date').value = '';
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user