Javascript cost estimator issue

Trying to have the option when clicking button “Add to quote” will add the result from the estimate into a new object in the cart. Then have the current cart show at the bottom. Here is the pen you can look at.

I’m a noob and there is some code i’m not using in there. I’m not sure if we can hire people here… I’m open to that if so.
other issues

I can only get Value to show instead of name above the price
I tried document.getElementById(“choice”).name and .getAttribute(“name”)

Thanks

yes. Pretty new to codepen so I transfered from my own files into here. I took that out now since I don’t need it in codepen. Thanks for the tips.

Worked like a charm. Thanks!

I have 2 checkboxes “low-e” “tempered”

is there a way that if the box is checked it will alter the price by adding totalSquareFeet x 3$ for example?

What about the add to quote button that takes the current estimated product and puts it into the cart?

OK. I have used your great advice and worked on my own.

When adding item to cart I want the bottom to display total price and total square feet and total count. But it does 100+100 = 100100 instead of 200 for example

Also, what about my results being limited to 2 decimal places?

Thanks for your guys’ help.

When you get the contents of the html using getElementBy, you’re extracting a string. If you use the “+” operator on 2 strings, then you’re just appending it together.

You need to convert the string to an int or float value before you add them, so you’ll get the numeric total (instead of a string concatenation)

1 Like

Thanks man. Got it working.

Thanks for your help got it working.