Skip to content
Advertisement

How to loop so I can separate 2 values? [closed]

I’m trying to make an inventory system as part for my e-commerce project so I need to get the price per product. The problem is when I use alert to display the data it combined. My main goal is to get the price per product (row) so I can compute it for the inventory

shopping cart:
shopping cart

The problem. the 2 product price combined. how can i separate them?:
The problem. the 2 product price combined. how can i separate them?

JavaScript

Advertisement

Answer

First, properly comment your code and indent your code so it is easy for anyone to read and understand.

Now to the answer:

Since you have multiple elements rendered in he DOM inside your php foreach, when you select the elements using $('.prodtotal') you get an array.

What you can do is,

JavaScript
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement