From 96a79e60e940b3df9bc8c0bb88f3acb162916797 Mon Sep 17 00:00:00 2001
From: vista-man <524715@vistacollege.nl>
Date: Mon, 27 Jan 2025 18:11:45 +0100
Subject: [PATCH] Add start and end date inputs to To-Do List application
---
JavaScript/to do/index.html | 2 ++
JavaScript/to do/script.js | 12 ++++++++++++
JavaScript/to do/styles.css | 36 ++++++++++++++++++++++++++++++++----
3 files changed, 46 insertions(+), 4 deletions(-)
diff --git a/JavaScript/to do/index.html b/JavaScript/to do/index.html
index 45b1327..03c46b6 100644
--- a/JavaScript/to do/index.html
+++ b/JavaScript/to do/index.html
@@ -48,6 +48,8 @@
To-Do List
+
+
diff --git a/JavaScript/to do/script.js b/JavaScript/to do/script.js
index 1d3a6ae..2784e28 100644
--- a/JavaScript/to do/script.js
+++ b/JavaScript/to do/script.js
@@ -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 = `
+ Start Date: ${startDate}
+ End Date: ${endDate}
+ `;
+
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 = '';
});
diff --git a/JavaScript/to do/styles.css b/JavaScript/to do/styles.css
index 8ebc6cb..b3f92ac 100644
--- a/JavaScript/to do/styles.css
+++ b/JavaScript/to do/styles.css
@@ -33,8 +33,36 @@ li.completed {
color: #888;
}
-button {
- background: none;
- border: none;
- cursor: pointer;
+input[type="text"], input[type="date"] {
+ margin: 5px 0;
+ padding: 10px;
+ border: 1px solid #ddd;
+ border-radius: 3px;
+ width: calc(100% - 22px);
+}
+
+button {
+ background: #007BFF;
+ color: white;
+ border: none;
+ padding: 10px 15px;
+ border-radius: 3px;
+ cursor: pointer;
+ margin-left: 5px;
+}
+
+button:hover {
+ background: #0056b3;
+}
+
+.task-details {
+ display: flex;
+ flex-direction: column;
+ align-items: flex-start;
+}
+
+.task-details span {
+ margin: 2px 0;
+ font-size: 0.9em;
+ color: #555;
}