This is a simple To-Do List app that allows users to add tasks to a list, mark tasks as completed, and delete tasks. The app uses HTML, CSS, and JavaScript to create a responsive and user-friendly interface.
- Add tasks to the list by typing in the input box and clicking the "Add" button or pressing the "Enter" key.
- Mark tasks as completed by clicking the checkbox next to the task.
- Delete tasks by clicking the "x" button next to the task.
- Clear all tasks by clicking the "Clear All" button.
- Persist data across page reloads using local storage.
To use the app, simply open the index.html
file in a web browser.
To add a task to the list, follow these steps:
- Type the task in the input box.
- Click the "Add" button or press the "Enter" key.
The task will be added to the list and displayed in the
list-container
element.
To mark a task as completed, follow these steps:
- Click the checkbox next to the task. The task will be displayed with a line through it to indicate that it has been completed.
To delete a task, follow these steps:
- Click the "x" button next to the task. The task will be removed from the list.
To clear all tasks from the list, follow these steps:
- Click the "Clear All" button. All tasks will be removed from the list.
The app uses the following technologies:
- HTML: for structuring the content.
- CSS: for styling the interface.
- JavaScript: for handling user interactions and persisting data.
The following is a brief overview of the code:
- The
inputBox
andlistContainer
variables are used to reference the input box and list container elements, respectively. - The
addTask
function is used to add tasks to the list. It checks if the input box is empty and displays an alert if it is. It then creates a new list item and appends it to the list container. - The event listener on the
listContainer
element is used to handle user interactions with the list items. It toggles the "checked" class on the list item when the user clicks on it and saves the data to local storage. It also removes the list item when the user clicks on the "x" button and saves the data to local storage. - The event listener on the
document
element is used to handle the user pressing the "Enter" key when the input box is focused. It triggers a click on the "Add" button. - The
saveData
function is used to save the data in the list container to local storage. - The
showData
function is used to display the data from local storage in the list container when the page is loaded. - The event listener on the
clearButton
element is used to clear all tasks from the list when the "Clear All" button is clicked.
This To-Do List app is a simple and easy-to-use tool for managing tasks. It uses modern web technologies to provide a responsive and user-friendly interface. The app is open source and can be modified and extended to meet specific needs.