A beginner-friendly JavaScript DOM cart system built with HTML, CSS, and vanilla JavaScript. This project shows how product data can be created, displayed, updated, deleted, and stored in the browser using localStorage.
GitHub Pages: https://sayedrisat.github.io/Cart-System-JSDom/
GitHub: https://github.com/sayedrisat/Cart-System-JSDom
This project is a simple cart/product management system. A user can click the Create Cart button, enter product details, and generate a product card dynamically. The product list is managed with JavaScript and saved in browser storage, so the data stays available after refreshing the page.
- Create a product card with product name, price, and image URL
- Display all products dynamically in the cart section
- Edit existing product details
- Delete products from the cart
- Store product data in browser
localStorage - Load saved products automatically when the page opens
- Validate empty form fields before creating a product
- Popup form open and close functionality
- Product card UI with image, details, and action buttons
document.querySelector()to select HTML elementsaddEventListener()for button clicks and form submissionpreventDefault()to stop default form reload behaviorinnerHTMLto render product cards dynamically- Template literals to generate card markup with product data
style.displayto show and hide the popup formform.reset()to clear input fields after submission- Inline button actions for edit and delete operations
- Array of product objects to manage cart data
JSON.parse()to read saved data fromlocalStorageJSON.stringify()to save product data inlocalStorageforEach()to loop through products and render cardsfind()to get the selected product for editingfindIndex()to find the product position in the arraysplice()to remove a product from the array- Conditional logic to handle create mode and update mode
- The app loads saved products from
localStorage. - The
Ui()function renders every product inside the.cardsboxcontainer. - Clicking Create Cart opens the popup form.
- Submitting the form creates a product object with name, price, and image.
- Product data is pushed into the array or updated if edit mode is active.
- The updated array is saved again in
localStorage. - Edit and delete buttons update the product list and refresh the UI.
- HTML5
- CSS3
- JavaScript
- DOM Manipulation
- LocalStorage
Cart-System-JSDom/
|-- index.html
|-- style.css
|-- script.js
|-- README.md
`-- LINKEDIN_POST.md
git clone https://github.com/sayedrisat/Cart-System-JSDom.git
cd Cart-System-JSDomThen open index.html in any browser.
JavaScript Cart System, DOM Manipulation Project, JavaScript CRUD App, LocalStorage Project, Shopping Cart JavaScript, Vanilla JavaScript Project, HTML CSS JavaScript Project, Beginner Frontend Project, Product Card CRUD, Browser Storage App.
Sayed Risat
GitHub: @sayedrisat