This project creates a simple shopping list webpage with the following functionalities:
Users can add items to the list. Users can mark items as purchased. Users can clear the entire list.
The shopping list items are stored in a JavaScript array (not persisted beyond page refresh). Running the Code:
Create three folders: html, css, and js. Place your code: Copy the provided HTML code into a file named index.html in the html folder. Copy the provided JavaScript code into a file named DOM.js in the js folder. Create a CSS file named style.css in the css folder (initially empty, you'll define styles for purchased items here). Open the HTML file: Open index.html in a web browser to run the application.
The index.html file defines the basic structure of the webpage, including the form for adding items, the list container, and buttons.
It creates an empty array to store shopping list items. It listens for form submission and adds the entered item to the list. It creates buttons ("purchased" and "clear") for each list item. Clicking "purchased" marks the item with a visual indicator (defined in style.css). Clicking "clear" removes all items from the list.
In style.css, define styles for the "purchased" class (e.g., strikethrough text, color change).
Implement local storage to persist the shopping list even after page refresh. Add features like item deletion, item editing, or priority levels.