Inspiration
What inspired me to do this project was to practice my coding skills so that I'm able to develop a website with input functions.
What it does
TimeLife allows you to add anything task that's on your mind by clicking "submit" or pressing the enter key. If you're done with a task, you can checkmark it, and click the "Delete a Task" button or pressing backspace or delete key.
How I built it
TimeLife was built using Visual Code Studio.
Challenges we ran into
I didn't practice JavaScript and I had to delay this project due to work.
Accomplishments that we're proud of
I was able to develop a simple to-do list and try new things that I've never done before.
What I learned
What I learned was that in JavaScript, in order to delete a checked task, I have to set the parameter of ".addEventListener" to "keydown", then I make an if statement and call out the function for removing it. Otherwise, if I set the parameter to "keypress", then I can't delete any task.
//Adding Event Listener for Enter and Delete Keys
document.addEventListener("keydown", function(event) { // Listen for keypress events on the input field
if (event.key === "Enter") {
if (input.value.trim() !== "") { // Check if the input is not empty or just whitespace
Add_a_Task();
}
} else if (event.key === "Delete" || event.key === "Backspace") { // Listen for Delete or Backspace key to delete tasks
Delete_a_Task();
}
});
Log in or sign up for Devpost to join the conversation.