I'm making a small grocery shopping app.
I want to make a page where the user see his/her shopping cart contents on clicking a button.
I created the template where the contents should show up in the white space. My idea is to store every item the user chooses in an array. For example:
var items = ["1 Chicken", "2 Tomatoes", "3 Spinach"]
Using this array I want to add these items line by line in the white space and then present the total amount to be paid. Kind of like a receipt. I'm not sure how to do this using JQuery.
Also, the contents of the should be empty when there's no items in the cart.
I did some research and I think I'm supposed to .html()? Though, I'm not sure about the logic behind what I want to achieve.
Here's the fiddle of the template. (The cdn links aren't working for some reason)
Could someone please help me with the logic?